#include <stdio.h>

int main() {
    float price,result;
    int month,day,n;
    scanf("%f %d %d %d",&price,&month,&day,&n);
    if(month == 11 && day == 11)
    {
        if(n == 1)
            result = price*0.7 -50;
        if(n == 0)
            result = price*0.7;
    }
    if(month == 12 && day == 12)
    {
        if(n == 1)
            result = price*0.8 -50;
        if(n == 0)
            result = price*0.8;
    }
    if(result < 0)
        result = 0;
    printf("%.2f",result);
    
    return 0;
}