def main():
    a, b, c, d, e = map(int, input().split())
    n = a * (b - c)

    ptice = d
    ans = 0
    for i in range(1, n + 1):
        if i % 10 == 0 and e <= ptice:
            ptice -= e
        ans += ptice
    print(ans)


if __name__ == "__main__":
    main()