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