#include <stdio.h>

int main() {
    float value;
    int day, month;
    float discount;
    int coupon;
    scanf("%f %d %d %d", &value, &month, &day, &coupon);
    if( value>=1 && value <=100000){
    if (month == 11 && day == 11) {
        if (coupon == 1) {
            discount = value * 0.7 - 50;
            if( discount < 0){
                printf("0.00");
            }
           else {
            printf("%.2f\n", discount);
        }
        }
        else {
            discount = value * 0.7;
            printf("%.2f",discount);
        }
        }
    
        if (month == 12 && day == 12) {
            if (coupon == 1) {
                discount = value * 0.8 - 50;
                if( discount < 0){
                printf("0.00");
            }
            else{
                printf("%.2f", discount);
            } 
            } 
            else {
                discount = value * 0.8;
                printf("%.2f",discount);
            }
        }
    if ((month != 12 && day != 12) && (month != 11 && day != 11) ){
        discount = value;
        printf("%.2f",discount);
    }
}
    if(value <1 || value >= 100000){
        printf("0.00");
    }

    return 0;
}