ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

1729. Dead Man's Chest

Time limit: 0.5 second
Memory limit: 64 MB
Captain Jack Sparrow was heading his Black Pearl full sail to a small island in the Caribbean. On that island, the Dead Man's Chest containing Davy Jones' heart was buried, and whoever possessed the heart could control the oceans of the world. Jack was in a hurry because he knew that his enemies, who also wanted to get hold of the valuable artifact, were rushing to the same island.
When the Pearl approached the island, captain Jack Sparrow lowered a boat and rowed to the shore. Upon reaching the island, he went through the thick jungle straight to its center, where the chest was hidden. Half an hour later, Jack dug it out and hold Davy Jones' still-beating heart in his hands. It was the time to get back to the ship. Jack leaped to his feet but then understood that he had been so eager to get the heart that he had not remembered where he had come from to that place. Therefore, he didn't know which way to go to return to the boat. Jack was struck with panic, because the enemies could appear any moment. He'd better get away as soon as possible.
Fortunately, Jack took with him a compass and a map of the island, so he could take any route through the island. Help Jack choose a route so that he would see his boat as soon as possible.
The island is a circle of radius r and the chest was buried at its center. Since the island is completely covered with jungle, Jack can observe the sea only when he is on the shore line. The boat is in the water near the shore so that it can only be seen from those points on the shore that are at most a degrees from the point on the shore line closest to the boat. It is known that Jack will not see the ship until he locates the boat.


The only input line contains space-separated real numbers r and a (1 ≤ r ≤ 1000; 0.001 ≤ a ≤ 45). The numbers contain at most three fractional digits.


Output the distance, precise up to 10−6, that Jack has to walk in the worst case before he will be able to see the boat, assuming that he chooses an optimal route.


1.000 30.000
Problem Author: Fedor Fominykh (prepared by Denis Dublennykh)
Problem Source: Ural Regional School Programming Contest 2009