#include <stdio.h>

int main() {
    int a, b, c;
    double sum = 0, money;
    scanf("%lf%d%d%d", &sum, &a, &b, &c);
    if (a == 11) {
        money = sum * 0.7;
        {
            if(c==1)
            money-=50;
        }
    } else {
        money = sum * 0.8;
        if(c==1)
            money-=50;
    }
    if(money<0)
    money=0;
    printf("%.2lf", money);
    return 0;
}