#include<stdio.h>
int main()
{
double a = 0.0;
int b, c, d;
scanf("%lf%d%d%d", &a, &b, &c, &d);
if (b == 11 && c == 11)
a = a * 0.7;
else if (b == 12 && c == 12)
a = a * 0.8;
else
{
a = a;
}
if (d == 1)
{
a = a - 50;
}
else
a = a;
if(a>0)
printf("%.2lf", a);
else
printf("0.00");
return 0;
}
int main()
{
double a = 0.0;
int b, c, d;
scanf("%lf%d%d%d", &a, &b, &c, &d);
if (b == 11 && c == 11)
a = a * 0.7;
else if (b == 12 && c == 12)
a = a * 0.8;
else
{
a = a;
}
if (d == 1)
{
a = a - 50;
}
else
a = a;
if(a>0)
printf("%.2lf", a);
else
printf("0.00");
return 0;
}