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