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