A square with side length is inscribed in a right triangle with legs of length and so that one vertex of the square coincides with the right-angle vertex of the triangle. A square with side length is inscribed in another right triangle with legs of length and so that one side of the square lies on the hypotenuse of the triangle. What is ?
For the first square, refer to the diagram below:
For the second square, refer to the diagram below: