a, b, c, d, e = map(int, input().split()) x = d ans = 0 for i in range(1, a * (b - c) + 1): if i % 10 == 0 and e <= x: x -= e ans += x print(ans)