#include #define FastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; void solve() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int total = 0; int cost = d * a; for (int ame = 1; ame <= b - c; ame++) { if (ame == 1) total += cost; else if (ame % 10 != 0) total += cost; else if (ame % 10 == 0 && e <= cost) total += max(cost - e, 0); else total += cost; } cout << total << '\n'; } int main() { FastIO; solve(); return 0; }