#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;
ll h,w;
cin>>h>>w;
ll a,b,c;
cin>>a>>b>>c;
ll n;
cin>>n;
vector<pll> pos(n+1);
for (int i=1;i<=n;i++) {
cin>>pos[i].F>>pos[i].S;
}
ll ans=0;
ll 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... |