#include <bits/stdc++.h>
using namespace std;
int a[3];
string s[] = {"Anka",   "Chapay", "Cleo",       "Troll",
              "Dracul", "Snowy",  "Hexadecimal"};
int axp = INT_MAX, afr = 0;
int team[8], sum[3];
int mat[8][8];
void dfs(int mem) {
  if (mem == 7) {
    int cnt[3] = {0}, i, j, xp = 0, fr = 0;
    for (i = 0; i < 7; i++) cnt[team[i]]++;
    sort(cnt, cnt + 3);
    if (cnt[0] == 0 || cnt[1] == 0 || cnt[2] == 0) return;
    for (i = 0; i < 3; i++) sum[i] = (a[i] / cnt[i]);
    sort(sum, sum + 3);
    xp = sum[2] - sum[0];
    for (i = 0; i < 7; i++) {
      for (j = 0; j < 7; j++) {
        if (team[i] == team[j] && mat[i][j] == 1) fr++;
      }
    }
    if (xp < axp || (xp == axp && fr > afr)) {
      axp = xp;
      afr = fr;
    }
    return;
  } else {
    for (int i = 0; i < 3; i++) {
      team[mem] = i;
      dfs(mem + 1);
    }
  }
  return;
}
int main() {
  int n, i, j, k;
  string s1, s2, s3;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> s1 >> s3 >> s2;
    for (j = 0; s[j] != s1; j++)
      ;
    for (k = 0; s[k] != s2; k++)
      ;
    mat[j][k] = 1;
  }
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  dfs(0);
  cout << axp << " " << afr << endl;
}
