#include <stdio.h>

int main() {
    float price ;
    int month , days , y;
    scanf("%f %d %d %d",&price , &month , &days , &y);

        if(month==11 && days==11 && y==1)
        price = price * 0.70 - 50;
        else if(month==11 && days==11)
        price = price * 0.70;
        else if(month==12 && days==12 && y==1)
        price = price * 0.80 - 50;
        else if(month==12 && days==12)
        price = price * 0.80;
        
    if(price  > 0  )
    {
        printf("%.2f\n",price);
    }
    else {
    printf("0.00\n");
    }
    return 0;
}