#include <bits/stdc++.h>
using namespace std;
char q[7][50] = {"Anka",   "Chapay", "Cleo",       "Troll",
                 "Dracul", "Snowy",  "Hexadecimal"};
map<string, int> h;
int a[3], u[7], v[3], w[7], r, rb, m[7][7];
void upd() {
  int i, mx, mn, j, k;
  for (i = 0; i < 3; v[i] = 0, i++)
    ;
  for (i = 0; i < 7; v[u[i]]++, i++)
    ;
  for (i = 0; i < 3; i++)
    if (!v[i]) return;
  for (i = 0; i < 7; w[i] = a[u[i]] / v[u[i]], i++)
    ;
  for (mx = w[0], mn = w[0], i = 1;
       i<7; mx = w[i]> mx ? w[i] : mx, mn = w[i] < mn ? w[i] : mn, i++)
    ;
  for (k = 0, i = 0; i < 7; i++)
    for (j = 0; j < 7; k += m[i][j] && u[i] == u[j], j++)
      ;
  if (mx - mn < r || (mx - mn == r && k > rb)) {
    r = mx - mn;
    rb = k;
  }
}
void rec(int i) {
  if (i == 7)
    upd();
  else
    for (u[i] = 0; u[i] < 3; rec(i + 1), u[i]++)
      ;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0), cerr << "";
  int i, j, t;
  char s[100];
  for (i = 0; i < 7; h[q[i]] = i, i++)
    ;
  for (cin >> t; t--;) {
    cin >> s;
    i = h[s];
    cin >> s >> s;
    j = h[s];
    m[i][j] = 1;
  }
  for (i = 0; i < 3; cin >> a[i], i++)
    ;
  r = 2000000010;
  rec(0);
  cout << r << " " << rb << endl;
  return 0;
}
