import sys readline=sys.stdin.readline A,B,C,D,E=map(int,readline().split()) cnt=A*(B-C) ans=0 for i in range(1,cnt+1): ans+=D if i%10==0: if D>=E: D-=E print(ans)