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