#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:16000000")
#pragma warning(disable : 4996)
const int inf = 2111111111;
const double eps = 1e-9;
string heroes[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                   "Dracul", "Snowy",  "Hexadecimal"};
int main() {
  int n;
  cin >> n;
  set<pair<int, int> > symp;
  for (int i = (0); i < (n); ++i) {
    string a, b, c;
    cin >> a >> b >> c;
    symp.insert(pair<int, int>(find(heroes, heroes + 7, a) - heroes,
                               find(heroes, heroes + 7, c) - heroes));
  }
  int deg3[10];
  deg3[0] = 1;
  for (int i = (1); i < (10); ++i) deg3[i] = deg3[i - 1] * 3;
  int a[3];
  for (int i = (0); i < (3); ++i) cin >> a[i];
  int maxSymp = 0;
  int minDif = -1;
  for (int mask = (1); mask < (deg3[7]); ++mask) {
    vector<vector<int> > groups(3);
    int cur = mask;
    for (int i = (0); i < (7); ++i) {
      groups[cur % 3].push_back(i);
      cur /= 3;
    }
    bool good = true;
    for (int i = (0); i < (3); ++i)
      if (groups[i].empty()) good = false;
    if (!good) continue;
    int x[3];
    int sympVal = 0;
    for (int i = (0); i < (3); ++i) {
      x[i] = a[i] / groups[i].size();
      for (int j = (0); j < ((int)groups[i].size()); ++j)
        for (int k = (0); k < ((int)groups[i].size()); ++k)
          sympVal += symp.count(pair<int, int>(groups[i][j], groups[i][k]));
    }
    sort(x, x + 3);
    int curDif = x[2] - x[0];
    if (minDif == -1 || curDif < minDif ||
        curDif == minDif && maxSymp < sympVal) {
      maxSymp = sympVal;
      minDif = curDif;
    }
  }
  cout << minDif << " " << maxSymp << endl;
  return 0;
}
