import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String[] str = bf.readLine().split(" ");
Double list_price = Double.parseDouble(str[0]);
int month = Integer.parseInt(str[1]);
int day = Integer.parseInt(str[2]);
int discount = Integer.parseInt(str[3]);
double price = 0;
if(month == 11 && day == 11 && discount == 1){
price = list_price*0.7 - 50;
if(price>0){
System.out.printf("%.2f",price);
}else{
System.out.printf("0.00");
}
}
if(month == 11 && day == 11 && discount == 0){
price = list_price*0.7;
System.out.printf("%.2f",price);
}
if(month == 12 && day == 12 && discount == 1){
price = list_price*0.8 - 50;
if(price>0){
System.out.printf("%.2f",price);
}else{
System.out.printf("0.00");
}
}
if(month == 12 && day == 12 && discount == 0){
price = list_price*0.8;
System.out.printf("%.2f",price);
}
}
}
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String[] str = bf.readLine().split(" ");
Double list_price = Double.parseDouble(str[0]);
int month = Integer.parseInt(str[1]);
int day = Integer.parseInt(str[2]);
int discount = Integer.parseInt(str[3]);
double price = 0;
if(month == 11 && day == 11 && discount == 1){
price = list_price*0.7 - 50;
if(price>0){
System.out.printf("%.2f",price);
}else{
System.out.printf("0.00");
}
}
if(month == 11 && day == 11 && discount == 0){
price = list_price*0.7;
System.out.printf("%.2f",price);
}
if(month == 12 && day == 12 && discount == 1){
price = list_price*0.8 - 50;
if(price>0){
System.out.printf("%.2f",price);
}else{
System.out.printf("0.00");
}
}
if(month == 12 && day == 12 && discount == 0){
price = list_price*0.8;
System.out.printf("%.2f",price);
}
}
}