num_candy,num_invite,num_reject,price,discount = map(int,input().split()) total = 0 for i in range(num_candy * (num_invite - num_reject)): if (i + 1) % 10 == 0: price -= discount if price >= discount else 0 total += price print(total)