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