#ARC101A. [ABC107C] Candles
[ABC107C] Candles
Score : points
Problem Statement
There are candles placed on a number line. The -th candle from the left is placed on coordinate . Here, holds.
Initially, no candles are burning. Snuke decides to light of the candles.
Now, he is at coordinate . He can move left and right along the line with speed . He can also light a candle when he is at the same position as the candle, in negligible time.
Find the minimum time required to light candles.
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum time required to light candles.
He should move and light candles as follows:
- Move from coordinate to .
- Light the second candle from the left.
- Move from coordinate to .
- Light the third candle from the left.
- Move from coordinate to .
- Light the fourth candle from the left.
- There may be a candle placed at coordinate .