#include <stdio.h>

int main() {
    float val;
    int month, day, coupon;
    scanf("%f %d %d %d", &val, &month, &day, &coupon);
    if (month == 11 && coupon == 1)
        printf("%.2f", val * 0.7 - 50 > 0 ? val * 0.7 - 50 : 0);
    else if (month == 11 && coupon == 0)
        printf("%.2f", val * 0.7 > 0 ? val * 0.7 : 0);
    else if (month == 12 && coupon == 1)
        printf("%.2f", val * 0.8 - 50 > 0 ? val * 0.8 - 50 : 0);
    else if (month == 12 && coupon == 0)
        printf("%.2f", val * 0.8 > 0 ? val * 0.8 : 0);
    return 0;
}