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