Problem Description
Rar the cat is walking to school. Rar is a very fortunate cat, the only separation between his school (S) and his house (H) is a road.
S
o--------------------------o [Road]
H
However, he can only cross the road at 2 traffic junctures, noted by (o), one at each end of the road. With this, he wants to find out the length of the shortest path between his house and the school.
To simplify this problem, the traffic light on the left [in the diagram] will at the 0m mark.
You will be provided with 3 numbers, l, the length of the road in metres, s, the distance from the school to the 0m mark (traffic light on the left) and h, the distance from Rar the cat's house to the 0m mark.
Assume that crossing the road does not incur to the total distance he has to walk.
Input
3 space-separated integers, l, s, h. You may assume all integers are not above 1000 and that s, h < l.
Output
Output the minimum distance Rar the cat has to walk, in order to reach his school.
Sample Input
8 5 7
Sample Output
4
Explanation of Sample Output
012345678
S~~~
o-------o
H~