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