
#include <bits/stdc++.h>

using namespace std;
    double punctaj;

#define MaxN 2005

ifstream file_in, file_out, file_ok;
int N, M, Max = 0, Opt;
int mat[MaxN][MaxN];
string word;
set<int> vals;

void WA() {
    cout << "0" << endl;
    cerr << "WA" << endl;
    if (file_ok.is_open())
        file_ok.close();
    if (file_out.is_open())
        file_out.close();
    exit(0);
}

void OK() {
    cout << punctaj << endl;
    cerr << "Accepted" << endl;
    if (file_ok.is_open())
        file_ok.close();
    if (file_out.is_open())
        file_out.close();
    exit(0);
}

void Partial(double score) {
    cout << floor(score) << endl;
    cerr << "Partially Correct" << endl;
    if (file_ok.is_open())
        file_ok.close();
    if (file_out.is_open())
        file_out.close();
    exit(0);
}

int main() {


    file_ok = ifstream("piezisa.ok");
    file_out = ifstream("piezisa.out");

    file_ok >> punctaj;

    if (!file_ok.is_open() || !file_out.is_open()) {
        WA();
    }
    string left, right;
    while(file_ok >> left) {
      file_out >> right;
      if(left != right)
        WA();
    }
    OK();
}
