#include <bits/stdc++.h>
using namespace std;
int ans1, ans2, p[6], sc[6], like[10][10], lik[6], arr[10];
string str1;
map<string, int> m1;
void btrack(int x) {
  int i, j, sum, max1, min1;
  if (x == 8) {
    if (!sc[1] || !sc[2] || !sc[3]) return;
    min1 = 2147483647;
    max1 = 0;
    for (i = 1; i <= 3; i++) {
      lik[i] = 0;
      if (p[i] / sc[i] > max1) max1 = p[i] / sc[i];
      if (p[i] / sc[i] < min1) min1 = p[i] / sc[i];
    }
    if (max1 - min1 < ans1) {
      ans1 = max1 - min1;
      sum = 0;
      for (i = 1; i <= 7; i++) {
        for (j = 1; j <= 7; j++) {
          if (i == j) continue;
          if (arr[i] == arr[j] && like[i][j]) lik[arr[i]]++;
        }
      }
      for (i = 1; i <= 3; i++) {
        sum += lik[i];
      }
      ans2 = sum;
    } else if (max1 - min1 == ans1) {
      for (i = 1; i <= 7; i++) {
        for (j = 1; j <= 7; j++) {
          if (i == j) continue;
          if (arr[i] == arr[j] && like[i][j]) lik[arr[i]]++;
        }
      }
      sum = 0;
      for (i = 1; i <= 3; i++) {
        sum += lik[i];
      }
      if (sum > ans2) ans2 = sum;
    }
    return;
  }
  for (i = 1; i <= 3; i++) {
    arr[x] = i;
    sc[i]++;
    btrack(x + 1);
    sc[i]--;
  }
}
int main() {
  int n, i, a, b;
  m1["Anka"] = 1;
  m1["Chapay"] = 2;
  m1["Cleo"] = 3;
  m1["Troll"] = 4;
  m1["Dracul"] = 5;
  m1["Snowy"] = 6;
  m1["Hexadecimal"] = 7;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    cin >> str1;
    a = m1[str1];
    cin >> str1;
    cin >> str1;
    b = m1[str1];
    like[a][b]++;
  }
  for (i = 1; i <= 3; i++) scanf("%d", &p[i]);
  ans1 = 2147483647;
  ans2 = 0;
  btrack(1);
  printf("%d %d\n", ans1, ans2);
  return 0;
}
