문제
You and a single robot are initially at point on a circle with perimeter (). You can move either counterclockwise or clockwise along the circle at unit per second. All movement in this problem is continuous.
Your goal is to place exactly robots such that at the end, every two consecutive robots are spaced away from each other (, divides ). There are () activation points, the th of which is located distance counterclockwise from (). If you are currently at an activation point, you can instantaneously place a robot at that point. All robots (including the original) move counterclockwise at a rate of unit per seconds ().
Compute the minimum time required to achieve the goal.
입력
The first line contains , , , and .
The next line contains space-separated integers .
출력
The minimum time required to achieve the goal.
예제 입력 1
10 2 1 2
6
예제 출력 1
22
예제 입력 2
10 2 1 2
7
예제 출력 2
4
예제 입력 3
32 4 5 2
0 23 12 5 11
예제 출력 3
48
예제 입력 4
24 3 1 2
16
예제 출력 4
48
점수
Inputs 5-6: Inputs 7-12: Inputs 13-20: Inputs 21-24: No additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인