#include <bits/stdc++.h>
using namespace std;
const int MN = 10;
const int INF = (1u << 31) - 1;
bool like[MN][MN];
map<string, int> mp;
int st[MN];
int b1 = INF, b2 = -1;
int g[3];
int n;
string a, b, temp;
void back_track(int a) {
  if (a == 7) {
    int mx = -1, mn = INF;
    int cnt[10];
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < 7; i++) cnt[st[i]]++;
    for (int i = 0; i < 3; i++)
      if (cnt[i] == 0) return;
    for (int i = 0; i < 7; i++) {
      int temp = g[st[i]] / cnt[st[i]];
      mx = max(mx, temp);
      mn = min(mn, temp);
    }
    if (mx - mn > b1) return;
    int fr = 0;
    for (int i = 0; i < 7; i++)
      for (int j = 0; j < 7; j++)
        if (st[i] == st[j] && like[i][j]) fr++;
    if ((mx - mn) < b1 || ((mx - mn) == b1 && fr > b2)) {
      b1 = mx - mn;
      b2 = fr;
    }
    return;
  }
  for (int i = 0; i < 3; i++) st[a] = i, back_track(a + 1);
}
int main() {
  mp["Anka"] = 0;
  mp["Chapay"] = 1;
  mp["Cleo"] = 2;
  mp["Troll"] = 3;
  mp["Dracul"] = 4;
  mp["Snowy"] = 5;
  mp["Hexadecimal"] = 6;
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> temp >> b;
    like[mp[a]][mp[b]] = 1;
  }
  cin >> g[0] >> g[1] >> g[2];
  back_track(0);
  cout << b1 << " " << b2 << endl;
  return 0;
}
