from decimal import Decimal
list_input = input().split(',')
distance = int(list_input[0])
waittimge_expense = int(list_input[1])
total_expense = 0
if distance <= 3:
total_expense = 13
elif 3 < distance <= 15:
total_expense = 13 + 2.3 * (distance - 3)
elif 15 < distance:
total_expense = 13 + 2.3 * (15 - 3) + (distance - 15) * (2.3 * 1.5)
print(Decimal(total_expense+waittimge_expense).quantize(Decimal('0'), rounding='ROUND_HALF_UP'))