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