season = input()
km_per_month = float(input())
total_km = km_per_month * 4
total_earned = 0
if km_per_month <= 5000:
if season == "Winter":
total_earned = 1.05 * total_km
elif season == "Summer":
total_earned = 0.9 * total_km
else:
total_earned = 0.75 * total_km
elif 5000 < km_per_month <= 10000:
if season == "Winter":
total_earned = 1.25 * total_km
elif season == "Summer":
total_earned = 1.1 * total_km
else:
total_earned = 0.95 * total_km
elif 10000 < km_per_month <= 20000:
total_earned = 1.45 * total_km
total_earned *= 0.9
print(f"{total_earned:.2f}")