#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; rep(ame, b - c) { if (ame == 0) total += d * a; else if (ame % 10 != 0) total += d * a; else if (ame % 10 == 0 && e <= d * a) total += max(d * a - e, 0); else total += d * a; } cout << total << '\n'; } int main() { FastIO; solve(); return 0; }