#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
const string password = "8d5d806ee0638f32a96dca2edb207f55d0a209a8b58b4b98b5174f6e3113e474";
void output_message(double points, string message){
	cout << points << endl;
	cerr << message << endl;
	exit(0);
}

int main (int argc, char** argv) {
	if(argc < 4){ output_message(0, "Insufficient arguments!"); return 1; }
	fstream input(argv[1]), output(argv[2]), contestant(argv[3]);
	if(!input.is_open()){ output_message(0, "Couldn't open input file."); return 1; }
	if(!output.is_open()){ output_message(0, "Couldn't open output file."); return 1; }
	if(!contestant.is_open()){ output_message(0, "Couldn't open contestant file."); return 1; }
	string check;
	contestant >> check;
	if(check != password){ output_message(0, "Contestant wrote to cout."); return 1; }
	double p1,p3,p2=0;
    contestant >> p1 >> p3;
    int ans1,ans2;
    contestant >> ans1 >> ans2;
	set<pair<int,int>> anses;
	int real1, real2;
	while(output >> real1 >> real2) if(real1==ans1 && real2==ans2) p2=1;
    cout << fixed << setprecision(2) << 0.25*p1+0.5*p2+0.25*p3 << endl;
	string message;
    while(contestant >> message) {
        cerr << message << " ";
    }
    cout << endl;
	exit(0);
	return 0;
}