Ancient Labyrinth
Throughout the millennia-long history of human civilization, one enduring mystery is the enigma of ancient labyrinths. Archaeologists have uncovered these structures in various regions, including Europe, South Africa, and New Zealand. Remarkably, all discovered labyrinths share a strikingly similar construction.
Each labyrinth consists of a broken line enclosed within a circle. This line begins at the circle's center and twists according to specific rules. Initially, the line extends directly north from the center for a length of h. It then turns east at a right angle, maintaining the same segment length. Next, the line turns south, increasing the segment length by h, and subsequently turns west, keeping the previous segment length. The line continues north again, further increasing the segment length by h, and this pattern repeats. The labyrinth concludes when a segment of the line crosses (without touching) the circle's boundary.
Your task is to develop a program that calculates the total length of the labyrinth, given the initial step h and the circle's radius R. This will aid scientists in unraveling the mystery of these labyrinths.
Input
The input consists of a single line with two integers separated by a space: R – the radius of the labyrinth (in meters), where 1 ≤ R ≤ 10, and h – the step of the labyrinth (in centimeters), where 1 ≤ h ≤ 1000.
Output
Output a single number representing the length of the labyrinth in meters, formatted to three decimal places.