#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, l, u, v, w, x, y, z, a, b, c, d, e, f, t = 1, tc;
  long long flg, sz, cnt, gt, ans, mx, mn;
  long long m, k, n;
  long long low, hi, md, inp[10], sm, ff, lk[10][10];
  memset(lk, 0, sizeof lk);
  map<string, int> mp;
  mp["Anka"] = 1;
  mp["Chapay"] = 2;
  mp["Cleo"] = 3;
  mp["Troll"] = 4;
  mp["Dracul"] = 5;
  mp["Snowy"] = 6;
  mp["Hexadecimal"] = 7;
  string st, st1, st2;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    cin >> st1 >> st >> st2;
    a = mp[st1];
    b = mp[st2];
    lk[a][b] = 1;
  }
  long long aa, bb, cc, tk[5], jj, kk, ii;
  scanf("%lld%lld", &aa, &bb), scanf("%lld", &cc);
  mn = 999999999999999;
  for (i = 1; i <= 7; i++) inp[i] = i;
  do {
    for (i = 1; i <= 5; i++) {
      for (j = i + 1; j <= 6; j++) {
        a = i;
        b = j - i;
        c = 7 - j;
        tk[0] = aa / a;
        tk[1] = bb / b;
        tk[2] = cc / c;
        sort(tk, tk + 3);
        ans = tk[2] - tk[0];
        if (ans <= mn) {
          if (ans < mn) gt = 0;
          mn = ans;
          cnt = 0;
          for (jj = 1; jj <= i; jj++) {
            for (kk = 1; kk <= i; kk++) {
              if (jj == kk) continue;
              int l1 = inp[jj], l2 = inp[kk];
              if (lk[l1][l2]) cnt++;
            }
          }
          for (jj = i + 1; jj <= j; jj++) {
            for (kk = i + 1; kk <= j; kk++) {
              if (jj == kk) continue;
              int l1 = inp[jj], l2 = inp[kk];
              if (lk[l1][l2]) cnt++;
            }
          }
          for (jj = j + 1; jj <= 7; jj++) {
            for (kk = j + 1; kk <= 7; kk++) {
              if (jj == kk) continue;
              int l1 = inp[jj], l2 = inp[kk];
              if (lk[l1][l2]) cnt++;
            }
          }
          gt = max(gt, cnt);
        }
      }
    }
  } while (next_permutation(inp + 1, inp + 1 + 7));
  cout << mn << " " << gt << endl;
  return 0;
}
