CF796A Buying A House
Description
Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us.
The girl lives in house $ m $ of a village. There are $ n $ houses in that village, lining in a straight line from left to right: house $ 1 $ , house $ 2 $ , ..., house $ n $ . The village is also well-structured: house $ i $ and house $ i+1 $ ( $ 1
Input Format
The first line contains three integers $ n $ , $ m $ , and $ k $ ( $ 2
Output Format
Print one integer — the minimum distance, in meters, from the house where the girl Zane likes lives to the house Zane can buy.
Explanation/Hint
In the first sample, with $ k=20 $ dollars, Zane can buy only house $ 5 $ . The distance from house $ m=1 $ to house $ 5 $ is $ 10+10+10+10=40 $ meters.
In the second sample, Zane can buy houses $ 6 $ and $ 7 $ . It is better to buy house $ 6 $ than house $ 7 $ , since house $ m=3 $ and house $ 6 $ are only $ 30 $ meters away, while house $ m=3 $ and house $ 7 $ are $ 40 $ meters away.