#include <bits/stdc++.h>
using namespace std;
int min_diff = 0x7fffffff;
int max_link = 0;
set<pair<int, int> > like;
int boss[3];
void test(int idx, vector<int> &can) {
  if (idx == 7) {
    set<int> c[3];
    for (int i = 0; i < 7; i++) {
      c[can[i]].insert(i);
    }
    if (c[0].size() == 0 || c[1].size() == 0 || c[2].size() == 0) return;
    int num_like = 0;
    for (int i = 0; i < 3; ++i) {
      for (auto it1 = c[i].begin(); it1 != c[i].end(); ++it1) {
        auto it2 = it1;
        ++it2;
        for (; it2 != c[i].end(); ++it2) {
          if (like.count(make_pair(*it1, *it2))) {
            ++num_like;
          }
          if (like.count(make_pair(*it2, *it1))) {
            ++num_like;
          }
        }
      }
    }
    int t[3] = {0, 1, 2};
    do {
      int p0 = boss[0] / c[t[0]].size();
      int p1 = boss[1] / c[t[1]].size();
      int p2 = boss[2] / c[t[2]].size();
      int max_p = max(p0, max(p1, p2));
      int min_p = min(p0, min(p1, p2));
      if (min_diff > max_p - min_p ||
          min_diff == max_p - min_p && max_link < num_like) {
        min_diff = max_p - min_p;
        max_link = num_like;
      }
    } while (next_permutation(t, t + 3));
  } else {
    for (int i = 0; i < 3; ++i) {
      can[idx] = i;
      test(idx + 1, can);
    }
  }
}
int main(void) {
  ios_base::sync_with_stdio(false);
  map<string, int> m = {{"Anka", 0},       {"Chapay", 1}, {"Cleo", 2},
                        {"Troll", 3},      {"Dracul", 4}, {"Snowy", 5},
                        {"Hexadecimal", 6}};
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    like.insert(make_pair(m[s1], m[s3]));
  }
  cin >> boss[0] >> boss[1] >> boss[2];
  vector<int> can(7);
  test(0, can);
  cout << min_diff << ' ' << max_link << endl;
  return 0;
}
