#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1 << 29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
int a, b, c, x, y;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
void solve() {
  cin >> a >> b >> c >> x >> y;
  int rest_a = a - c;
  int rest_b = b - c;
  int cost = rest_a + rest_b;
  int ans = 0;
  int need_ab = 0;
  if (cost > 0) {
    if (rest_a > rest_b) {
      need_ab = x * 2;
    } else if (rest_a < rest_b) {
      need_ab = y * 2;
    } else {
      need_ab = max(x, y) * 2;
    }
    int need_a = x - (need_ab / 2) > 0 ? x - (need_ab / 2) : 0;
    int need_b = y - (need_ab / 2) > 0 ? y - (need_ab / 2) : 0;
    ans = (a * need_a) + (b * need_b) + (c * need_ab);
  } else {
    ans = (a * x) + (b * y);
  }
  cout << "cost=" << cost << endl;
  cout << "need_ab=" << need_ab << endl;
  cout << ans << endl;
  return;
}
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(int args, char* argv[]) { solve(); }
