a,b,c,d,e=map(int,input().split()) ame=a*(b-c) kane=0 i=1 nedan=d for _ in range(ame): if i == 1: kane=d if i%10 != 0: kane=kane+nedan elif nedan >= e: nedan=nedan-e kane=kane+nedan else: kane=kane+nedan i=i+1 print(kane)