#include <bits/stdc++.h>
int main() {
  long long a = 0, b = 0, c = 0, x = 0, y = 0;
  long long honraisum = 0, toku = 0;
  long long change = 0;
  std::cin >> a >> b >> c >> x >> y;
  honraisum = a * x + b * y;
  toku = (a + b) - (c * 2);
  if (toku > 0) {
    change = (x + y) / 2;
    std::cout << honraisum - (toku * change) << std::endl;
  } else {
    std::cout << honraisum << std::endl;
  }
}
