#include <bits/stdc++.h>
using namespace std;
int n, v[10];
long long a, b, c, ma, mb;
bool g[10][10];
long long iabs(long long k) { return (k > 0) ? k : (-k); }
void dfs(int k) {
  if (k == 8) {
    int k1 = 0, k2 = 0, k3 = 0, km = 0;
    for (int i = 1; i <= 7; i++)
      if (v[i] == 1)
        k1++;
      else if (v[i] == 2)
        k2++;
      else
        k3++;
    if (k1 == 0 || k2 == 0 || k3 == 0) return;
    for (int i = 1; i <= 7; i++)
      for (int j = 1; j <= 7; j++)
        if (g[i][j] && v[i] == v[j]) km++;
    long long m1 = a / k1, m2 = b / k2, m3 = c / k3, mm = 0;
    if (iabs(m1 - m2) > mm) mm = iabs(m1 - m2);
    if (iabs(m1 - m3) > mm) mm = iabs(m1 - m3);
    if (iabs(m3 - m2) > mm) mm = iabs(m3 - m2);
    if (mm < ma || mm == ma && km > mb) {
      ma = mm;
      mb = km;
    }
    return;
  }
  for (int i = 1; i <= 3; i++) {
    v[k] = i;
    dfs(k + 1);
    v[k] = 0;
  }
}
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;
  while (scanf("%d", &n) != EOF) {
    memset(g, false, sizeof(g));
    ma = 2147483647;
    mb = 0;
    for (int i = 1; i <= n; i++) {
      string s1, s2;
      cin >> s1;
      cin >> s2;
      cin >> s2;
      g[mp[s1]][mp[s2]] = true;
    }
    cin >> a >> b >> c;
    dfs(1);
    cout << ma << " " << mb << endl;
  }
  return 0;
}
