#include #include // AtCoder using namespace std; using namespace atcoder; // AtCoder using uint = unsigned int; using ll = long long; using ull = unsigned long long; using ld = long double; using mint = modint998244353; // AtCoder using vll = vector; using vvll = vector>; using vvvll = vector>>; using vvvvll = vector>>>; using dll = deque; using ddll = deque>; using dddll = deque>>; using ddddll = deque>>>; using pll = pair; using vpll = vector>; using vvpll = vector>>; #define rep(i, n) for (long long i = 0; i < n; i++) #define reps(i, n) for (long long i = 1; i <= n; i++) #define rrep(i, n) for (long long i = n - 1; i >= 0; i--) #define rreps(i, n) for (long long i = n; i >= 1; i--) #define reep(i, a, b) for (long long i = a; i < b; i++) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define PI acos(-1.0) #define YES printf("Yes\n"), exit(0) #define NO printf("No\n"), exit(0) constexpr long long MOD = 998244353LL; constexpr long long INF = (1LL << 60); template void setcout(T n) {cout << setprecision(n) << fixed;} template void arrcout(T &a) { for(size_t i = 0; i < a.size(); i++) cout << (i ? " " : "") << a.at(i); cout << endl; } template void arrcout2(T &a) { for(size_t i = 0; i < a.size(); i++) { for(size_t j = 0; j < a[i].size(); j++) cout << (j ? " " : "") << a.at(i).at(j); cout << endl;} } template bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } //#pragma GCC target("avx2") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") int main() { ll a, b, c, d, e; cin >> a >> b >> c >> d >> e; ll p = a - b; cout << max(p, p + c * (d - e)) << endl; }