/* -*- coding: utf-8 -*- * * 1453.cc: No.1453 手助け - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { int a, b, c, d, e; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); int n = a * (b - c); int sum = 0; for (int i = 1, x = d; i <= n; i++) { if (i % 10 == 0 && e <= x) x -= e; sum += x; } printf("%d\n", sum); return 0; }