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