#include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int x = b - c; if (x <= 0) { cout << 0 << endl; return 0; } int cur = d; int ans = 0; for (int i = 1; i <= x * a; i++) { if (i % 10 != 0) { ans += cur; } else if (e <= cur) { cur -= e; ans += cur; } else { ans += cur; } } cout << ans << endl; return 0; }