def discount(price, isDiscount): if isDiscount: price -= 50 return price if price > 0 else 0 while True: try: price, month, day, isDiscount = map(float, input().split()) result = price if month == 11 and day == 11: print('{:.2f}'.format(discount(result*0.7, isDiscount))) elif month == 12 and day == 12: print('{:.2f}'.format(discount(result*0.8, isDiscount))) else: print('{:.2f}'.format(result)) except EOFError: break