Hide

Problem A
Infinite Slides

Agneta and Beata are visiting the famous Swedish Amusement Park of Infinite Fun and Games. Their favourite attraction is the Infinitely Long Slides. Each slide can be viewed as an infinitely long, completely vertical spiral of radius $1$.

When projected into the (flat) ground, the first slide has $(0, 0)$ as its centre point, and the second one has $(1, 0)$ as its centre point. Furthermore, the start of the slides are at $(1, 0)$ and $(2, 0)$ respectively, and then proceeds counter-clockwise around their respective centres. When Agneta rides her slide (the first one), she does so with vertical speed $1\text { m/s}$, while Beatas slide has a bit higher gradient, so she goes with vertical speed $2\text { m/s}$. However, their angular speeds around the centre is both equal to $1 \text { rad/s}$. Since Beata is a little afraid of the slides, she always waits for Agneta to go first. $W$ seconds after Agneta went, Beata starts her descent.

To make the infinite ride a bit more fun, the amusement park gives a prize if the two riders on the slides manage to pass a ball between them at some point. This prize consists of a lot of chocolate, which is Beata’s favourite treat. To maximize their chances of passing the ball successfully, they want to wait until their Euclidean distance is the smallest possible during the ride. How small will this distance be?

Input

The first and only line of the input contains the decimal number $0 \le W \le 1000$. The number contains at most $6$ digits after the decimal point.

Output

Output a single number – the minimal Euclidean distance between Agneta and Beata during their trip. Your answer will be accepted if it is within a relative or absolute error of $10^{-4}$ of the judges’ answer.

Sample Input 1 Sample Output 1
0
1
Sample Input 2 Sample Output 2
6.283185
1
Sample Input 3 Sample Output 3
42
1.5228490019
Sample Input 4 Sample Output 4
1.047198
2

Please log in to submit a solution to this problem

Log in