#include int main(void){ int a,b,c,d,e; scanf("%d%d%d%d%d",&a,&b,&c,&d,&e); int count = (b - c) * a; long long ans = 0; int x; x = d; //printf("%d ",count); for(int i=1;i<=count;i++){ if(i == 1){ ans = d; continue; } if(i%10 == 0){ if(e <= x){ ans += x - e; x = x - e; } } ans += x; //printf("%d ",x); } printf("%lld\n",ans); return 0; }