A, B, C, D, E = map(int, input().split())

ans = 0
for n in range(1, A*(B-C)+1):
    ans += max(D-E*(n//10), D%E)

print(ans)