Finding sides of right triangles