Hide

Problem E
Halfway There

\includegraphics[width=0.2\textwidth ]{checkpoint_flag.png}

Mario is on the way to save Princess Peach from Bowser.1 However, Bowser has set up all manner of traps and obstacles to stop Mario. If Mario fails any one of these obstacles, he must start over from the beginning.

Mario has only $400$ seconds to make it through all of the traps to save Princess Peach in time for the Mushroom Kingdom Ball. The path to save Peach is short enough to be finished in time, but Mario is not confident in passing all of the obstacles on his first try.

Thankfully, Mario has one checkpoint flag that he can place down at any point on the path that will become his new starting point should he fail any obstacle. However, Mario must pick the optimal location for the checkpoint flag to minimize the expected amount of time to complete the course. If the flag is placed too close to the start, it will be more difficult to make it from the flag to the end. On the other hand, if Mario intends to place the flag closer to the end, he is more likely to have to start over before he places it. Mario has deduced that the optimal location for the flag will be at the exact halfway point between the start and the end.

Since Mario is already occupied with overcoming the obstacles as quickly as possible, he has asked you to write a program to determine the optimal location for the checkpoint flag given the distance offset from his starting location to where Bowser is holding Princess Peach captive.

Input

A real number, $D$, that consists of up to $1\, 000\, 000$ digits, that represents the distance offset from Mario’s starting location to Princess Peach.

Output

Print out the exact distance from the start where Mario should place the checkpoint flag.

Sample Input 1 Sample Output 1
2
1
Sample Input 2 Sample Output 2
1
0.5
Sample Input 3 Sample Output 3
1.875
0.9375
Sample Input 4 Sample Output 4
-0.125
-0.0625

Footnotes

  1. Super Mario, associated characters, and above image © Nintendo Co., Ltd. Used here for educational purposes only, in accordance with fair use as defined by section 107 of the Copyright Act.

Please log in to submit a solution to this problem

Log in