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