#include <stdio.h>

int main()
{
    float price = 0.0f;
    int month = 0;
    int day = 0;
    int coupon = 0;
    scanf("%f %d %d %d", &price, &month, &day, &coupon);//输入
    if (month == 11)//判断是双十一还是双十二
    {
        price = price * 0.7 - 50 * coupon;
    }
    else
    {
        price = price * 0.8 - 50 * coupon;
    }
    price = price > 0 ? price : 0.0f;//判断价格是否为负数
    printf("%.2f\n", price);//输出
    return 0;
}