#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
char name1[15], name2[15], other[15];
double a[5], d[5];
int n[5];
bool vis[15][15];
int Get(char name[]) {
  if (strcmp(name, "Anka") == 0) return 1;
  if (strcmp(name, "Chapay") == 0) return 2;
  if (strcmp(name, "Cleo") == 0) return 3;
  if (strcmp(name, "Troll") == 0) return 4;
  if (strcmp(name, "Dracul") == 0) return 5;
  if (strcmp(name, "Snowy") == 0) return 6;
  if (strcmp(name, "Hexadecimal") == 0) return 7;
}
int Dis(int n3, int n2, int n1) {
  d[1] = (int)(a[1] * 1.0 / n1);
  d[2] = (int)(a[2] * 1.0 / n2);
  d[3] = (int)(a[3] * 1.0 / n3);
  sort(d + 1, d + 1 + 3);
  return d[3] - d[1];
}
int Sum(int n3, int n2, int n1) {
  int a[15], res = 0;
  for (int i = 1; i <= 7; i++) {
    a[i] = i;
  }
  do {
    vector<int> se[5];
    for (int i = 1; i <= n1; i++) {
      se[1].push_back(a[i]);
    }
    for (int i = n1 + 1; i <= n1 + n2; i++) {
      se[2].push_back(a[i]);
    }
    for (int i = n1 + n2 + 1; i <= n1 + n2 + n3; i++) {
      se[3].push_back(a[i]);
    }
    int tmp = 0;
    for (int k = 1; k <= 3; k++) {
      for (int i = 0; i < se[k].size(); i++) {
        int u = se[k][i];
        for (int j = 0; j < se[k].size(); j++) {
          int v = se[k][j];
          if (vis[u][v]) tmp++;
          if (vis[v][u]) tmp++;
        }
      }
    }
    tmp /= 2;
    res = max(res, tmp);
  } while (next_permutation(a + 1, a + 1 + 7));
  return res;
}
int main() {
  int m;
  scanf("%d", &m);
  int u, v;
  memset(vis, false, sizeof(vis));
  for (int i = 1; i <= m; i++) {
    scanf("%s%s%s", name1, other, name2);
    u = Get(name1);
    v = Get(name2);
    vis[u][v] = true;
  }
  for (int i = 1; i <= 3; i++) {
    scanf("%lf", &a[i]);
  }
  sort(a + 1, a + 1 + 3);
  int ans1 = INF, t1;
  int ans2 = 0, t2;
  t1 = Dis(5, 1, 1);
  t2 = Sum(5, 1, 1);
  if (ans1 > t1)
    ans1 = t1, ans2 = t2;
  else if (ans1 == t1)
    ans2 = max(ans2, t2);
  t1 = Dis(4, 2, 1);
  t2 = Sum(4, 2, 1);
  if (ans1 > t1)
    ans1 = t1, ans2 = t2;
  else if (ans1 == t1)
    ans2 = max(ans2, t2);
  t1 = Dis(3, 3, 1);
  t2 = Sum(3, 3, 1);
  if (ans1 > t1)
    ans1 = t1, ans2 = t2;
  else if (ans1 == t1)
    ans2 = max(ans2, t2);
  t1 = Dis(3, 2, 2);
  t2 = Sum(3, 2, 2);
  if (ans1 > t1)
    ans1 = t1, ans2 = t2;
  else if (ans1 == t1)
    ans2 = max(ans2, t2);
  printf("%d %d\n", ans1, ans2);
  return 0;
}
