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