#include<stdio.h>
int main(){
    int month=0,day=0,coupon=0;
    float price=0,total=0;
    scanf("%f %d %d %d",&price,&month,&day,&coupon);
    if(month==11&&day==11){
        price=price*0.7;
        if(coupon==1){
            price=price-50;
        }
    }
    else if(month==12&&day==12){
        price=price*0.8;
        if(coupon==1){
            price=price-50;
        }
    }
    else{
        if(coupon==1){
            price=price-50;
        }
    }
    if(price<=0){//防止商家倒给钱
        price=0;
    }
    printf("%.2f",price);
    return 0;
}