#include<bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define F first 
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>
using vvector = vector<vector<T>>;
const int INF = 0x3f3f3f3f;
int main() {
    speed;
    int h,w;
    cin>>h>>w;
    int a,b,c;
    cin>>a>>b>>c;
    int n;
    cin>>n;
    vector<pii> pos(n+1);
    for (int i=1;i<=n;i++) {
        cin>>pos[i].F>>pos[i].S;
    }
    int ans=0;
    int dx=abs(pos[1].F-pos[2].F),dy=abs(pos[1].S-pos[2].S);
    ans=min({dx*a+b+dy*c,dy*a+b+dx*c,(dx+dy)*c});
    cout<<ans<<"\n";
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |