#include using namespace std; int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int mx = INT32_MIN; for (int i = 0; i <= c; i++) { mx = max(mx, a + i * d - b - e * i); } cout << mx << endl; }