#define _GLIBCXX_DEBUG #include using namespace std; int main() { int A, B, C, D, E; cin >> A >> B >> C >> D >> E; int ame = A*(B-C), ans = 0, last = 0; for(int i = 1; i <= ame; i++){ if(i == 1){ ans += D; last = D; } else{ if(i%10 == 0 and E <= last) last -= E; ans += last; } } cout << ans << endl; }