#include <bits/stdc++.h>
using namespace std;
map<string, int> N;
int l[7][7], e[3], x[7], c[3], dExp = -1, lc = 0;
void solve(int t) {
  if (t >= 7) {
    if (c[0] && c[1] && c[2]) {
      vector<int> g[3];
      int eMin = e[x[0]] / c[x[0]], eMax = e[x[0]] / c[x[0]];
      g[x[0]].push_back(0);
      for (int i = 1; i < 7; i++) {
        int exp = e[x[i]] / c[x[i]];
        if (exp < eMin) eMin = exp;
        if (exp > eMax) eMax = exp;
        g[x[i]].push_back(i);
      }
      int tmp = eMax - eMin, tl = 0;
      for (int i = 0; i < 3; i++)
        for (unsigned int p = 0; p < g[i].size(); p++)
          for (unsigned int q = 0; q < g[i].size(); q++)
            if (q != p && l[g[i][q]][g[i][p]]) tl++;
      if (dExp == -1 ||
          (dExp != -1 && (tmp < dExp || (tmp == dExp && tl > lc)))) {
        dExp = tmp;
        lc = tl;
      }
    }
  } else
    for (int i = 0; i < 3; i++) {
      int tmp = x[t];
      x[t] = i;
      c[i]++;
      solve(t + 1);
      c[i]--;
      x[t] = tmp;
    }
}
int main() {
  N["Anka"] = 0;
  N["Chapay"] = 1;
  N["Cleo"] = 2;
  N["Troll"] = 3;
  N["Dracul"] = 4;
  N["Snowy"] = 5;
  N["Hexadecimal"] = 6;
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  while (n--) {
    string p, q;
    cin >> p >> q >> q;
    l[N[p]][N[q]] = 1;
  }
  cin >> e[0] >> e[1] >> e[2];
  solve(0);
  cout << dExp << " " << lc << endl;
  return 0;
}
