#include <stdio.h>

int main() {
    double money,month,day,Q,y=0.8,sum;
    scanf("%lf %lf %lf %lf",&money,&month,&day,&Q);
    if(month==11) y=0.7;//日期一定为双十一或者双十二,只需判断月份
    if(Q==1) sum=money*y-50;
    else sum=money*y;
    if(sum<0) sum=0;
    printf("%.2lf\n",sum);
    return 0;
}