#include<stdio.h>
int main()
{
	double price = 0; 
	int month = 0; 
	int day = 0;
	int discount = 0;  
	scanf("%lf %d %d %d", &price , &month , &day , &discount); 
	if (month == 11 && day == 11)
	{
		if (discount == 1)
		{
			price =price*0.7 - 50;  
		}
		else if(discount == 0 )
		{
			price =price*0.7; 
		}
	}
	if (month == 12 && day == 12)
	{
		if (discount == 1)
		{
			price = price * 0.8 - 50;
		}
		else if (discount == 0)
		{
			price = price * 0.8;
		}
	}
	if (price <= 0)
		printf("%.2lf", 0); 
	else
		printf("%.2lf", price);    
	return 0; 
}