#include <bits/stdc++.h>
using namespace std;
const int MAX = 8;
map<string, int> mp;
int g[MAX][MAX];
int st[5];
long long mi = 1LL << 60, ma = 0;
long long ep[5];
void init() {
  mp["Anka"] = 0;
  mp["Chapay"] = 1;
  mp["Cleo"] = 2;
  mp["Troll"] = 3;
  mp["Dracul"] = 4;
  mp["Snowy"] = 5;
  mp["Hexadecimal"] = 6;
}
int cot(int x) {
  int ret = 0;
  while (x) {
    if (x & 1) ret++;
    x >>= 1;
  }
  return ret;
}
void run() {
  long long ret = 0, cnt = 0;
  long long x = -1, y = 1LL << 60;
  for (int i = 0; i < 3; i++) {
    x = max(x, ep[i] / cot(st[i]));
    y = min(y, ep[i] / cot(st[i]));
    for (int j = 0; j < 7; j++) {
      for (int k = 0; k < 7; k++) {
        if ((st[i] & (1 << j)) && (st[i] & (1 << k)) && g[j][k]) {
          cnt++;
        }
      }
    }
  }
  ret = x - y;
  if (ret < mi || ret == mi && cnt > ma) {
    mi = ret;
    ma = cnt;
  }
}
void dfs(int k, int s) {
  if (k == 3) {
    if (s == 0) {
      run();
    }
    return;
  }
  for (int i = s; i; i = (i - 1) & s) {
    st[k] = i;
    dfs(k + 1, s ^ i);
  }
}
int main() {
  char a[120], b[120];
  int m;
  init();
  memset(g, 0, sizeof(g));
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%s%*s%s", a, b);
    g[mp[a]][mp[b]] = 1;
  }
  for (int i = 0; i < 3; i++) {
    scanf("%I64d", &ep[i]);
  }
  dfs(0, (1 << 7) - 1);
  printf("%I64d %I64d\n", mi, ma);
  return 0;
}
