#include <stdio.h>
int main(){
int m,d,y;
float p;
scanf("%f%2d%2d%d",&p,&m,&d,&y);
if(m==11&&d==11){
if(y==1) p=p*0.7-50;
else p*=0.7;
}
if(m==12&&d==12){
if(y==1) p=p*0.8-50;
else p*=0.8;
}
if(p<=0) p=0;
printf("%.2f",p);
return 0;
}
int main(){
int m,d,y;
float p;
scanf("%f%2d%2d%d",&p,&m,&d,&y);
if(m==11&&d==11){
if(y==1) p=p*0.7-50;
else p*=0.7;
}
if(m==12&&d==12){
if(y==1) p=p*0.8-50;
else p*=0.8;
}
if(p<=0) p=0;
printf("%.2f",p);
return 0;
}