#include <bits/stdc++.h>
using namespace std;
bool like[10][10];
int main() {
  map<string, int> mp;
  mp["Anka"] = 1;
  mp["Chapay"] = 2;
  mp["Cleo"] = 3;
  mp["Troll"] = 4;
  mp["Dracul"] = 5;
  mp["Snowy"] = 6;
  mp["Hexadecimal"] = 7;
  int n, i, j, k, l, x, y;
  string str1, str2, str3;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> str1 >> str2 >> str3;
    like[mp[str1]][mp[str3]] = 1;
  }
  int a[5], b[5];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  int ans = 1e9;
  for (i = 1; i <= 5; i++)
    for (j = 1; j <= 5; j++) {
      k = 7 - i - j;
      b[0] = i;
      b[1] = j;
      b[2] = k;
      if (k <= 0) continue;
      sort(b, b + 3);
      int mx = 0, mn = 1e9;
      for (l = 0; l < 3; l++) {
        mn = min(mn, a[l] / b[l]);
        mx = max(mx, a[l] / b[l]);
      }
      if (mx - mn < ans) ans = mx - mn;
    }
  int ans2 = 0;
  for (i = 1; i <= 5; i++)
    for (j = 1; j <= 5; j++) {
      k = 7 - i - j;
      b[0] = i;
      b[1] = j;
      b[2] = k;
      sort(b, b + 3);
      if (k <= 0) continue;
      int mn1 = 1e9, mx1 = 0;
      for (l = 0; l < 3; l++) {
        mn1 = min(mn1, a[l] / b[l]);
        mx1 = max(mx1, a[l] / b[l]);
      }
      if (mx1 - mn1 == ans) {
        int arr[10];
        for (l = 0; l < 7; l++) arr[l] = l + 1;
        do {
          int c = 0;
          for (x = 0; x < b[0]; x++) {
            for (y = 0; y < b[0]; y++) {
              if (like[arr[x]][arr[y]] == 1) c++;
            }
          }
          for (x = b[0]; x < b[0] + b[1]; x++) {
            for (y = b[0]; y < b[0] + b[1]; y++) {
              if (like[arr[x]][arr[y]] == 1) c++;
            }
          }
          for (x = b[0] + b[1]; x < b[0] + b[1] + b[2]; x++) {
            for (y = b[0] + b[1]; y < b[0] + b[1] + b[2]; y++) {
              if (like[arr[x]][arr[y]] == 1) c++;
            }
          }
          if (c > ans2) ans2 = c;
        } while (next_permutation(arr, arr + 7));
      }
    }
  cout << ans << " " << ans2 << endl;
  return 0;
}
