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