시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 14 8 8 80.000%

문제

모형 로켓이 얼마나 높이 올라갔는지 측정하는 방법은 여러 가지가 있는데, 그 중 하나는 다음과 같다.

관측하는 사람 A,B,C가 D 만큼 떨어져서 경위계를 가지고, 수평선에서 떨어진 각도를 측정한다. 각 측정 장비는 지면에서 H만큼 떨어져 있다. 로켓이 발사된 후 가장 높은 지점 근처에서, 낙하산을 펼친 후, 먼지 더미를 분출한다. 각각의 관측자는 먼지 더미와 수평선과의 각도를 측정한다.

A,B,C가 측정한 각을 각각 a,b,c라 하면 이 값을 이용하여 높이를 측정할 수 있다.

D,H,a,b,c가 주어졌을 때, 로켓이 올라간 높이(반올림)를 계산하는 프로그램을 작성하시오.

입력

첫 줄은 10진수 D,H가 들어온다. (정수가 아닐 수 있다) 이 값들은 모든 로켓에 대해 같다. 다음 줄부터 각 줄에는 a,b,c(각도)가 들어오며, 마지막 줄에는 0보다 작거나 같은 값이 들어온다. 입력의 마지막을 나타내는 마지막 줄을 제외하고는 모두 0도 초과부터 90도 미만 사이의 각이다.

출력

각각의 3개의 각에 대해 높이를 반올림 하여 정수로 출력한다.

예제 입력 1

50 4
43.88 46.85 40.70
34.52 39.50 35.43
27.05 29.22 26.14
0 0 0

예제 출력 1

90
70
60
W3sicHJvYmxlbV9pZCI6IjI3NjEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJhYThcdWQ2MTUgXHViODVjXHVjZjEzXHVjNzU4IFx1YjE5Mlx1Yzc3NCIsImRlc2NyaXB0aW9uIjoiPHA+XHJcblx0XHViYWE4XHVkNjE1IFx1Yjg1Y1x1Y2YxM1x1Yzc3NCBcdWM1YmNcdWI5YzhcdWIwOTggXHViMTkyXHVjNzc0IFx1YzYyY1x1Yjc3Y1x1YWMxNFx1YjI5NFx1YzljMCBcdWNlMjFcdWM4MTVcdWQ1NThcdWIyOTQgXHViYzI5XHViYzk1XHVjNzQwIFx1YzVlY1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