#include <bits/stdc++.h>
const int INF = 2147483647;
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll price = LONG_LONG_MAX;
  for (int i = (0); i < (1e5 + 1); i++) {
    ll p = c * i + max(0LL, x - i) + max(0LL, y - i);
    price = min(p, price);
  }
  cout << price << endl;
  return 0;
}
