Олимпиадный тренинг

Задача 44034. Get to the toys


Santa Claus decided to check the toy factory to see if all the gifts for children are ready. To get to the toy storage area, he needs to go through a narrow secret corridor. In the corridor, for each meter of the path, the number of meters from the door is indicated. At the door, near which Santa Claus is standing, the number 0 is written. You can move along the corridor both to the left and to the right. When moving to the left, the numbers are negative, when moving to the right, they are positive.

Because the location is classified, the factory is constantly changing the entrance to the toy store. 

Santa Claus knows that today the entrance to the factory is located at the door with the number X. It is also known that in the corridor, next to the number Y there is a door blocking the passage along the corridor. To open it, you need to take the key, which is located on the wall on the shelf in the corridor next to the number Z.

Determine if Santa Claus himself can get to the door to the toys. If possible, determine the minimum distance that Santa Claus will need to walk. If it fails, then print -1.



Input
The program receives as input a string containing 3 different non-zero numbers: X, Y, Z (-103 <= X, Y, Z <= 103).

Imprint
Print the minimum distance that Santa Claus needs to walk from the door where he is standing to the door behind which there is a place to store toys. If Santa Claus can't get to this door, print -1.
 
 
Examples
# Input Output
1 10 -10 1 10
2 20 10 -10 40
3 100 1 1000 -1