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