#include<iostream> #include<string> #include<algorithm> #include<cctype> #include<set> #include<bitset> #include<math.h> #include<map> #include<queue> #include<iomanip> using namespace std; int main(){ int a, b, c, d, e, t, r, sum1 = 0; cin >> a >> b >> c >> d >> e; t = (b -c)*a; r = t/10; for (int i = 1; i <= t; i++){ if (i%10 == 0 && d > e) d = d-e; sum1 += d; } cout << sum1 << endl; }