In HDU, you have to run along the campus for 24 times, or you will fail in PE. According to the rule, you must keep your speed, and your running distance should not be less than $K$ meters.
There are $4$ checkpoints in the campus, indexed as $p_1,p_2,p_3$ and $p_4$. Every time you pass a checkpoint, you should swipe your card, then the distance between this checkpoint and the last checkpoint you passed will be added to your total distance.
The system regards these $4$ checkpoints as a circle. When you are at checkpoint $p_i$, you can just run to $p_{i-1}$ or $p_{i+1}$($p_1$ is also next to $p_4$). You can run more distance between two adjacent checkpoints, but only the distance saved at the system will be counted.
Checkpoint $p_2$ is the nearest to the dormitory, Little Q always starts and ends running at this checkpoint. Please write a program to help Little Q find the shortest path whose total distance is not less than $K$.