#include<bits/stdc++.h>
using namespace std;
#define S second
#define F first
#define ll long long
//#define int long long
//#pragma GCC optimize("Ofast, unroll-loop")
//#pragma GCC target("avx,avx2")
#pragma GCC optimize("O3")
const int inf=0x3f3f3f3f;
const ll inff=0x3f3f3f3f3f3f3f3f;
//const int X=1000000007;
const int X=998244353;
int x[5], y[5];
signed main(){
ios::sync_with_stdio(0), cin.tie(0);
int h, w; cin >> h >> w;
int a, b, c; cin >> a >> b >> c;
int n; cin >> n;
for(int i=1 ; i<=n ; i++) cin >> x[i] >> y[i];
int dx=abs(x[2]-x[1]), dy=abs(y[2]-y[1]);
ll ans=min({1LL*a*dx+b+1LL*c*dy,1LL*a*dy+b+1LL*c*dx,1LL*(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... |