Tycho
문제
The planetary exploration vehicle Tycho VIII needs to get back to the home base after collecting mineral samples. Tycho travels in a straight line from position to the home base at position . While moving, it advances at a slow but steady pace of unit per second. Every second, Tycho takes unit of environmental damage from the harsh planetary conditions.
The situation is made even worse by radiation from a nearby pulsar, which adds additional units of damage every seconds. However, the radiation damage can be avoided by seeking shelter in one of different hiding spots---caves, vegetation, large rocks, carcasses of the planet's megafauna---along the way. Tycho can choose to stand still at any point for any integer number of seconds.
The starting position and the home base at are both sheltered, so Tycho takes no radiation damage there.
What is the minumum damage Tycho will take on its journey back to the home base?
Consider the situation where the home base is at position and there are shelters at positions and .
Assume that the pulsar's period is , so unsheltered Tycho would take damage at times , , , etc. If Tycho leaves from the starting position (where it's sheltered) at time , it can reach the first shelter after seconds, incurring radiation damage at time (but none at time because it's sheltered then). Continuing without stopping, it reaches the home base at time , incurring more units of radiation damage (at times and , respectively). This way it incurs units of radiation damage and units of environmental damage. If instead Tycho waits at the nd shelter (at position ) for second, the pulse at time causes it no damage, and it reaches the home base at time with a total of units of damage. This is better for most values of . The two situations are shown here:
If the pulsar's period is , Tycho can wait at the starting position for seconds and then just go home without stopping at any shelter. Thus it passes the st shelter (at position ) at just the right moment when the pulsar flares and arrives at the home base at time , for a total of environmental damage and no radiation damage at all.
입력
The first line consists of four integers , , , and , separated by single spaces: the location of the home base, the pulsar's flare period , the additional radiation damage caused by each flare of the pulsar, the number of the shelters. The following lines each contain an integer giving the shelter locations , , , with .
출력
Print a single integer: the minimum amount of damage Tycho must take to reach .
예제
예제 1
18 4 5 2 8 15
29
예제 2
18 4 0 2 8 15
18
예제 3
18 10 100 2 8 15
20
예제 4
18 4 100 0
418
예제 5
65 20 100 3 14 25 33
172