Problem: 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 \leq i \leq N$) stands at ($S_i, T_i$). There is only one ball in the field, and the player 1 has it. You stand at ($S_N, T_N$) with the player $N$. The clearance is finished if the ball is passed to ($S_N, T_N$), 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 \times 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.





Example

Input

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


Output

26

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<ll,int> ii;
#define fi first
#define se second
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
ll A,B,C;
int n,h,w;
ll dp0[505][505], dp1[505][505][4];
bool player[505][505];
int min_distance[505][505];
void prep(){
	queue <int> q;
	for(int i=0;i<=h;i++)
		for(int j=0;j<=w;j++){
			if (player[i][j]) min_distance[i][j] = 0, q.push(i * 501 + j);
			else min_distance[i][j] = 100000;
		}
	while(q.size()){
		int x = q.front() / 501;
		int y = q.front() % 501;
		q.pop();
		for(int k=0;k<4;k++){
			int X = x + dx[k];
			int Y = y + dy[k];
			if (0 > X || X > h || 0 > Y || Y > w) continue;
			if (min_distance[X][Y] > min_distance[x][y] + 1)
				min_distance[X][Y] = min_distance[x][y] + 1,
				q.push(X * 501 + Y);
		}
	}
}
#define x1 asd
#define y1 jnda
#define xn addaf
#define yn nln
int x1,y1,xn,yn;
void prep_dp(){
	for(int i=0;i<=h;i++)
		for(int j=0;j<=w;j++)
			dp0[i][j] = dp1[i][j][0] = dp1[i][j][1] = dp1[i][j][2] = dp1[i][j][3] = (ll) 1e18;
	dp0[x1][y1] = 0;
}
bool  markh[505], markw[505];
 
void cal_dp(){
	priority_queue <ii,vector<ii>,greater<ii> > pq;
	
	pq.push(ii(0, x1 * 3500 + y1 * 5));
		
	while(pq.size()){
		int x = pq.top().se / 3500;
		int y = (pq.top().se % 3500) / 5;
		int type = pq.top().se % 5;
		ll dis = pq.top().fi;
		pq.pop();
		
		if (type == 0 && dp0[x][y] != dis) continue;
		if (type && dp1[x][y][type-1] != dis) continue;
		
		if (type == 0){
			for(int k=0;k<4;k++){
				int X = x + dx[k];
				int Y = y + dy[k];
				if (0 > X || X > h || 0 > Y || Y > w) continue;
				if (dp1[X][Y][k] > dp0[x][y] + A + B)
					dp1[X][Y][k] = dp0[x][y] + A + B,
					pq.push(ii(dp1[X][Y][k], X * 3500 + Y * 5 + k+1));
					
				if (dp0[X][Y] > dp0[x][y] + C)
					dp0[X][Y] = dp0[x][y] + C,
					pq.push(ii(dp0[X][Y], X * 3500 + Y * 5 + 0));
			}
		}
		else{
			int X = x + dx[type-1];
			int Y = y + dy[type-1];
			if (dp1[x][y][type-1] + min_distance[x][y] * C < dp0[x][y])
				dp0[x][y] = dp1[x][y][type-1] + min_distance[x][y] * C,
				pq.push(ii(dp0[x][y], x*3500 + y*5));
			if (0 > X || X > h || 0 > Y || Y > w) continue;
			if (dp1[X][Y][type-1] > dp1[x][y][type-1] + A)
				dp1[X][Y][type-1] = dp1[x][y][type-1] + A,
				pq.push(ii(dp1[X][Y][type-1], X * 3500 + Y * 5 + type));
			
		}
	}
}
int main(){
	iostream::sync_with_stdio(0);
	cin >> h >> w;
	cin >> A >> B >> C;
	cin >> n;
	for(int i=1;i<=n;i++){
		int x,y;
		cin >> x >> y; 
		if (i == 1) x1 = x, y1 = y;
		if (i == n) xn = x, yn = y;
		player[x][y] = 1;
	}
	prep();
	prep_dp();
	cal_dp();
	cout << dp0[xn][yn] << endl;
}