시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB53322958.000%

## 문제

You are a manager of a prestigious soccer team in the JOI league.

The team has N players numbered from 1 to N. The players are practicing hard in order to win the tournament game. The field is a rectangle whose height is H meters and width is W meters. The vertical line of the field is in the north-south direction, and the horizontal line of the field is in the east-west direction. A point in the field is denoted by (i, j) if it is i-meters to the south and j meters to the east from the northwest corner of the field.

After the practice finishes, players must clear the ball. In the beginning of the clearance, the player i (1 ≦ i ≦ N) stands at (Si , Ti). There is only one ball in the field, and the player 1 has it. You stand at (SN, TN) with the player N. The clearance is finished if the ball is passed to (SN, TN), and you catch it. You cannot move during the clearance process.

You can ask players to act. But, if a player acts, his fatigue degree will be increased according to the action. Here is a list of possible actions of the players. If a player has the ball, he can act (i),(ii), or (iii). Otherwise, he can act (ii) or (iv).

(i) Choose one of the 4 directions (east/west/south/north), and choose a positive integer p. Kick the ball to that direction. Then, the ball moves exactly p meters. The kicker does not move by this action, and he loses the ball. His fatigue degree is increased by A × p + B.

(ii) Choose one of the 4 directions (east/west/south/north), and move 1 meter to that direction. If he has the ball, he moves with it. His fatigue degree is increased by C regardless of whether he has the ball or not.

(iii) Place the ball where he stands. He loses the ball. His fatigue degree does not change.

(iv) Take the ball. His fatigue degree does not change. A player can take this action only if he stands at the same place as the ball, and nobody has the ball.

Note that it is possible for a player or a ball to leave the field. More than one players can stand at the same place.

Since the players just finished the practice, their fatigue degrees must not be increased too much. You want to calculate the minimum possible value of the sum of fatigue degrees of the players for the clearance process.

Given the size of the field and the positions of the players, write a program which calculates the minimum possible value of the sum of fatigue degrees of the players for the clearance process.

## 입력

Read the following data from the standard input.

• The first line of input contains two space separated integers H, W. This means the field is a rectangle whose height is H meters and width is W meters.
• The second line contains three space separated integers A, B, C describing the increment of the fatigue degree by actions.
• The third line contains an integer N, the number of players.
• The i-th line (1 ≤ i ≤ N) of the following N lines contains two space separated integers Si, Ti. This means, in the beginning of the clearance, the player i (1 ≤ i ≤ N) stands at (Si, Ti).

## 출력

Write one line to the standard output. The output contains the minimum possible value of the sum of fatigue degrees of the players for the clearance process.

## 제한

All input data satisfy the following conditions.

• 1 ≤ H ≤ 500.
• 1 ≤ W ≤ 500.
• 0 ≤ A ≤ 1 000 000 000.
• 0 ≤ B ≤ 1 000 000 000.
• 0 ≤ C ≤ 1 000 000 000.
• 2 ≤ N ≤ 100 000.
• 0 ≤ Si ≤ H(1 ≤ i ≤ N).
• 0 ≤ Ti ≤ W(1 ≤ i ≤ N).
• (S1, T1) ≠ (SN, TN).

## 서브태스크

번호배점제한
15

N = 2.

230

N ≤ 1 000, A = 0.

365

## 예제 입력 1

6 5
1 3 6
3
1 1
0 4
6 5


## 예제 출력 1

26


Sample Input 1 does not satisfy the constraints of Subtask 1. Also, it does not satisfy the constraints of Subtask 2.

In this sample input, the initial status of the field is as in the following figure. The white circles are the players. The black circle is the ball. You stand at (6, 5).

The initial status of the field

The players act as follows:

1. The player 1 kicks the ball to the east for 3 meters. His fatigue degree is increased by 1 × 3 + 3 = 6. The ball moves to (1, 4).
2. The player 2 moves 1 meter to the south, and he has the ball. His fatigue degree is increased by 6.
3. The player 2 moves 1 meter to the east. His fatigue degree is increased by 6.
4. The player 2 kicks the ball to the south for 5 meters. His fatigue degree is increased by 1 × 5 + 3 = 8. The ball moves to (6, 5).

In these actions, the sum of fatigue degrees is 6 + 6 + 6 + 8 = 26, which is the minimum possible value.

The actions in an optimal solution

## 예제 입력 2

3 3
0 50 10
2
0 0
3 3


## 예제 출력 2

60


Sample Input 2 satisfies the constraints of Subtask 1 and Subtask 2. In Sample Input 2, it not not necessary to kick the ball.

## 예제 입력 3

4 3
0 15 10
2
0 0
4 3


## 예제 출력 3

45


Sample Input 3 satisfies the constraints of Subtask 1 and Subtask 2.

## 예제 입력 4

4 6
0 5 1000
6
3 1
4 6
3 0
3 0
4 0
0 4


## 예제 출력 4

2020


Sample Input 4 does not satisfy the constraints of Subtask 1. But it satisfies the constraints of Subtask 2. Note that more than one players can stand at the same place.

## 채점 및 기타 정보

• 예제는 채점하지 않는다.