#include<bits/stdc++.h>
using namespace std;
int main() {
int R, B, C, D, E;
cin >> R >> B >> C >> D >> E;
int res1 = (R * C + B * D);
int res2 = 0;
if (R > B) {
res2 = R * E * 2 + (R-B) * C;
}
else if (R <= B) {
res2 = R * E * 2 + (B-R) * D;
}
cout << max(res1, res2);
return 0;
}