#include <bits/stdc++.h>
using namespace std;
long long keta(long long a) {
  long double b = a;
  b = log10(b);
  long long c = b;
  return c + 1;
}
signed main() {
  long long a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  long long ans = 10000000000;
  for (long long i = 0; i < 200010; i += 2) {
    long long d = x * (max<long long>(x - i / 2, 0));
    long long e = y * (max<long long>(y - i / 2, 0));
    ans = max(i * c + a * d + e + b, ans);
  }
  cout << ans << endl;
}
