URI Online Judge | 2335

Arquibaldo's Challenge

By Felipe GetĂșlio, UEA BR Brazil

Timelimit: 2

Arquibaldo is a very smart boy known to be the "bam-bam-bam" of mathematical questions related to geometric figures. Calculation of areas, perimeters, side measures, Arquibaldo was tired of small challenges. For him, it was all very easy. His aunt Helena, however, being a math english teacher, decided to give him a little harder challenge. Helena showed him four identical triangles and formed with them a square such that their sides were the measures of the hypotenuse of the chosen triangles. Then she told the nephew that depending on the measures of right triangles, there may or there may not be a smaller square in the center of the second largest. The illustrations below show clearly these cases:

She challenged him: "If I give the sides of the inner and outer square, l1 and l2, for example, can you tell me the smallest internal angle's measure, in degrees, of the triangle that would form with three other identical triangles a square with side mesure l1 and other with side mesure l2? ". Arquibaldo, has started to solve the challenge. Because he can't use calculator, her aunt was a good girl and allowed that only the integer parte of the answer was presented, ie, without decimal places. This way, Arquibaldo has now to find the greatest integer measure of the right triangle's smaller angle, such that the side of the inner square made by this new triangle (with the inner angle's measure being integer) be greater or equal to the inner square's side, that is, this should "fit" in the new inner square. For example, if the sides of the inner and outer squares have measures 1 and 5, respectively, then the smallest angle will approximate measure of 36,87Âș (degrees), however, the greatest integer measure is 36, because for a set of four angles of right triangles 36 and 54 (complement) form squares of side 5 and 1,10 units of measure, that is, the square of side 1 would "fit" in a square of side 1.10, with this angle.

"Watch out for the existence of the triangle! Remember: now the angle measurements can only be integer numbers, "warned Helena to Arquibaldo for possible mistakes because she's brother. In the above example, the triangle has angles of 36, 54 and 90 degrees. Knowing that you are a programmer (it was not reported to Helena if you were good or not), Helena asked you to do a program to inform the feedback from figures provided by her to Arquibaldo, to see if he really knew how to solve the challenge.


The input consists of several test cases. Each case corresponds to a row containing the values of the internal and external sides of the squares, L1 e L2 (1 <= L1, L2 <= 105) not necessarily in that order.


For each test case, print the entire greater extent smaller inner angle of the right triangle, respecting the above conditions. If the angle of the triangle in question does not exist, print the message "Nao existe tal triangulo.".

Input Sample Output Sample

102 100
100 101
40 40
2 1
1 5
1 10
32293 22321

Nao existe tal triangulo.
Nao existe tal triangulo.