#include using namespace std; int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; if (b-c == 0) { puts("0"); return 0; } int ans = d; int pre = d; for (int i = 1; i < (b-c)*a; i++) { if ((i+1)%10 == 0 && e <= pre) { pre = pre-e; } ans += pre; } cout << ans << endl; return 0; }