#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
int binpow(int n, int k)
{
int a = 1;
while (k)
{
if (k % 2)
a = a * n % mod;
n = n * n % mod;
k /= 2;
}
return a;
}
int inv(int n)
{
return binpow(n, mod - 2);
}
int N = 2e5 + 1;
vector<int> fact(N + 1);
int comb(int n, int k)
{
return fact[n] * inv(fact[k] * fact[n - k] % mod) % mod;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int h, w;
cin >> h >> w;
int a, b, c;
cin >> a >> b >> c;
int n;
cin >> n;
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
cout << min({(abs(x1 - x2) + abs(y1 - y2)) * c, abs(x1 - x2) * c + a * abs(y1 - y2) + b, abs(x1 - x2) * a + b + abs(y1 - y2) * c});
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... |