spoj#NPC2016A. Runner Game

Runner Game

当前没有测试数据。

Today, Waca will play runner game. In this game, the player will be placed in a square-shaped arena where they will run to checkpoints of the arena.

Arena of the game is a square with a side length of N. The player will be placed in a coordinate (X,Y) inside the arena. The following are the rules of the game :

  • Player will be initially at coordinate (X,Y), where coordinate (0,0) is the bottom left corner of the arena
  • Then, player should run to the side of the arena to get the checkpoints
  • Checkpoints are located in each side of the arena (top, left, bottom, right) and player should take all the checkpoints (i.e. they have to visit all sides), then go back to the initial position of the player (X,Y)
  • If the player reach the corner of the arena, he can take 2 checkpoints. For example, if a player reach coordinate (0,0), he is considered to get the left and bottom checkpoints

Now, Waca is curious, what is the minimum distance to get all the checkpoints and go back to his initial position? The image below is one of the possible moves for the runner game. (The red circle is Waca's initial position (X,Y) )

Sample run

Input

The input will contain 3 integers, X, Y, and N.

Output

Print the minimum distance Waca need to finish the game. Your answer is considered to be correct if the difference is no more than 10-6

Example

Input:
6 4 10

Output: 28.284271

</p>

Constraints:

  • 1 ≤ N ≤ 106
  • 0 ≤ X,Y ≤ N