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
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<functional>
#define PAIR pair<int,int>
using namespace std;
class point{
public:
    vector<long long> dp;
    long long fast;
    point(){
        dp.resize(5,((long long)1<<63)-1);
        fast = 10000000;
    }
};
int H,W;
long long A,B,C,N;
vector<PAIR> mv;
class num{
public:
    long long time;
    PAIR pos;
    int dir;
};

bool operator<(const num&A,const num&B){
    return A.time<B.time;
}
bool operator>(const num&A,const num&B){
    return A.time>B.time;
}
bool operator==(const num&A,const num&B){
    return A.time==B.time;
}

PAIR operator + (const PAIR&A,const PAIR&B){
    PAIR res;
    res.first = A.first+B.first;
    res.second = A.second+B.second;
    return res;
}

point& getpa(vector<vector<point> >&map,PAIR d){
    int x =d.first;
    int y = d.second;
    return map[x][y];
}

void getfast(vector<vector<point> >&,vector<PAIR>&);
bool isin(int,int);
int main(){
    mv.resize(5);
    mv[0]=PAIR(1,0);
    mv[1]=PAIR(0,-1);
    mv[2]=PAIR(-1,0);
    mv[3]=PAIR(0,1);
    mv[4]=PAIR(0,0);
    cin>>H>>W>>A>>B>>C>>N;
    vector<vector<point> > map(W+1,vector<point>(H+1));
    vector<PAIR> player(N);
    for(int i=0;i<N;++i){
        cin>>player[i].second>>player[i].first;
    }
    getfast(map,player);
    priority_queue<num,vector<num>,greater<num> > que;
    getpa(map,player[0]).dp[4]=0;
    num start;
    start.time = 0;
    start.pos = player[0];
    start.dir = 4;
    /*
    for(int y=0;y<map.front().size();++y){
        for(int x=0;x<map.size();++x){
            cout<<map[x][y].dp[4]<<" ";
        }
        cout<<endl;
    }
     */
    que.push(start);
    while(!que.empty()){
        num d = que.top();
        que.pop();
        if(d.time!=getpa(map,d.pos).dp[d.dir]){
            continue;
        }
        if(d.dir<4){
            PAIR np = d.pos + mv[d.dir];
            if(isin(np.first,np.second)){
                long long ntime = d.time + A;
                if(ntime<getpa(map,np).dp[d.dir]){
                    getpa(map,np).dp[d.dir] = ntime;
                    num dnum;
                    dnum.time = ntime;
                    dnum.pos = np;
                    dnum.dir = d.dir;
                    que.push(dnum);
                }
            }
            long long ntime = d.time + getpa(map,d.pos).fast;
            if(ntime<getpa(map,d.pos).dp[4]){
                getpa(map,d.pos).dp[4] = ntime;
                num dnum;
                dnum.time = ntime;
                dnum.pos = d.pos;
                dnum.dir = 4;
                que.push(dnum);
            }
        }else{
            for(int i=0;i<4;++i){
                long long ntime = d.time + B;
                if(ntime<getpa(map,d.pos).dp[i]){
                    getpa(map,d.pos).dp[i]=ntime;
                    num dnum;
                    dnum.time = ntime;
                    dnum.pos = d.pos;
                    dnum.dir = i;
                    que.push(dnum);
                }
                ntime = d.time + C;
                PAIR np = d.pos + mv[i];
                if(!isin(np.first,np.second)){
                    continue;
                }
                if(ntime<getpa(map,np).dp[4]){
                    getpa(map,np).dp[4]=ntime;
                    num dnum;
                    dnum.time = ntime;
                    dnum.pos = np;
                    dnum.dir = 4;
                    que.push(dnum);
                }
            }
        }
    }
    cout<<getpa(map,player.back()).dp[4]<<endl;
    
    /*
    for(int y=0;y<map.front().size();++y){
        for(int x=0;x<map.size();++x){
            cout<<map[x][y].dp[4]<<" ";
        }
        cout<<endl;
    }
     */
    return 0;
}

void getfast(vector<vector<point> >& map,vector<PAIR>&player){
    queue<PAIR> que;
    for(int i=0;i<player.size();++i){
        int x = player[i].first;
        int y = player[i].second;
        que.push(player[i]);
        getpa(map,player[i]).fast=0;
    }
    while(!que.empty()){
        PAIR d = que.front();
        que.pop();
        for(int i=0;i<4;++i){
            PAIR np = d+mv[i];
            if(!isin(np.first,np.second)){
                continue;
            }
            if(getpa(map,np).fast>getpa(map,d).fast+1){
                getpa(map,np).fast = getpa(map,d).fast+1;
                que.push(np);
            }
        }
    }
    for(int x=0;x<map.size();++x){
        for(int y=0;y<map.front().size();++y){
            getpa(map,PAIR(x,y)).fast*=C;
        }
    }
}

bool isin(int x,int y){
    return x>=0&&x<=W&&y>=0&&y<=H;
}
