#include <bits/stdc++.h>
using namespace std;
int a[7], b[3], ans1, ans2;
int c[3], m[7][7] = {0};
int n, eng[3];
char s[7][20] = {"Anka",   "Chapay", "Cleo",       "Troll",
                 "Dracul", "Snowy",  "Hexadecimal"};
int findit() {
  int i, j, k = 0;
  for (i = 0; i < 7; i++)
    for (j = 0; j < 7; j++)
      if (a[i] == a[j] && m[i][j]) k++;
  return k;
}
void dfs(int pos) {
  int i, j, t;
  if (pos == 7) {
    for (i = 0; i < 3; i++) b[i] = 0;
    for (j = 0; j < 7; j++) b[a[j]]++;
    for (i = 0; i < 3; i++)
      if (b[i] == 0) break;
    if (i < 3) return;
    for (i = 0; i < 3; i++) {
      t = eng[i] / b[i];
      c[i] = t;
    }
    sort(c, c + 3);
    t = findit();
    if (c[2] - c[0] < ans1) {
      ans1 = c[2] - c[0];
      ans2 = t;
    } else if (c[2] - c[0] == ans1 && t > ans2)
      ans2 = t;
    return;
  }
  for (i = 0; i < 3; i++) {
    a[pos] = i;
    dfs(pos + 1);
  }
}
int main() {
  int i, j, u, v;
  char str1[20], str2[20];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> str1 >> str2 >> str2;
    for (u = 0; u < 7; u++)
      if (strcmp(str1, s[u]) == 0) break;
    for (v = 0; v < 7; v++)
      if (strcmp(str2, s[v]) == 0) break;
    m[u][v] = 1;
  }
  for (i = 0; i < 3; i++) cin >> eng[i];
  ans1 = 2100000000;
  ans2 = 0;
  dfs(0);
  cout << ans1 << ' ' << ans2 << endl;
  return 0;
}
