A,B,C,D,E=map(int,input().split()) N=(B-C)*A V=0 for i in range(1,N+1): if i%10==0 and E<=D: D -=E V += D print(V)