#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
static const std::string PASSWORD = "32978942479237592564384318978573475";

void output(double points, std::string message) {
    std::cerr << message << '\n';
    std::cout << points << '\n';
    exit(0);
}

int main(int argc, char *argv[]) {
    std::ifstream in(argv[1]);
    std::ifstream sol(argv[2]);
    std::ifstream out(argv[3]);

    if (!in) output(0, "Input file not found!\n");
    if (!out) output(0, "Output file not found!\n");
    if (!sol) output(0, "Solution file not found!\n");

    std::string password;

    if (!(out >> password)) output(0, "Error reading output file!\n");
    if (password != PASSWORD) output(0, "Contestant program wrote to stdout!\n");

    double result;
    std::string msg;

    if (!(out >> result)) output(0, "Error reading output file!\n");
    getline(out, msg);
    if (!getline(out, msg)) output(0, "Error reading output file!\n");
    output(result, msg);
    
    return 0;
}
