#include int main(void) { int a, b, c, d, e; int x; int total = 0; int i; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); x = d; total = x; if(b == c){ printf("0\n"); return 0; } for(i = 2;i <= a * (b - c);i++){ if(i % 10 != 0){ total += x; } else { if(e <= x){ x = x - e; if(x < 0)x = 0; total += x; } else { total += x; } } } printf("%d\n", total); return 0; }