Problem7122--ABC270 —— B - Hammer

7122: ABC270 —— B - Hammer

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

Takahashi is at the origin of a number line. He wants to reach a goal at coordinate $X$.
There is a wall at coordinate $Y$, which Takahashi cannot go beyond at first.
However, after picking up a hammer at coordinate $Z$, he can destroy that wall and pass through.
Determine whether Takahashi can reach the goal. If he can, find the minimum total distance he needs to travel to do so.

Input

The input is given from Standard Input in the following format:
$X\ Y\ Z$

Output

If Takahashi can reach the goal, print the minimum total distance he needs to travel to do so. If he cannot, print -1 instead.

Constraints

$−1000≤X,Y,Z≤1000$
X, Y, and Z are distinct, and none of them is 0.
All values in the input are integers.

Sample 1 Input

10 -10 1

Sample 1 Output

10
Takahashi can go straight to the goal.

Sample 2 Input

20 10 -10

Sample 2 Output

40
The goal is beyond the wall. He can get there by first picking up the hammer and then destroying the wall.

Sample 3 Input

100 1 1000

Sample 3 Output

-1

Source/Category