A,B,C,D,E = map(int,input().split()) guest = B-C candy = A*(B-C) ans = 0 cost = D for i in range(candy): if i == 0: ans += cost else: cost = cost-E if i%10 == 0 and E <= cost else cost ans += cost print(ans)