#include #include using namespace std; // #define DISABLE_PRINT #if defined(ENABLE_PRINT) && !defined(DISABLE_PRINT) #define P(...) fprintf(stderr, __VA_ARGS__) #define LP fprintf(stderr, "L: %d\n", __LINE__) #else #define P(...) ((void)0) #define LP ((void)0) #endif #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define ALL(x) x.begin(), x.end() using ll = long long; using ull = unsigned long long; const int INF = 1100100100; const ll INFLL = 1100100100100100100; int main() { ll A, B, C, D, E; cin >> A >> B >> C >> D >> E; auto ans = A - B; rep(i, C) { A += D; B += E; ans = max(ans, A - B); } cout << ans << endl; return 0; }