#include <bits/stdc++.h>
using namespace std;
vector<string> names;
char *cnames[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                  "Dracul", "Snowy",  "Hexadecimal"};
int n = 7;
int id(const string &s) {
  for (int i = 0; i < (int(names.size())); ++i)
    if (s == names[i]) return i;
}
vector<pair<int, int> > s;
const int INF = 2000000100;
int bdif = INF, bs = 0;
int cp[7];
int pts[3];
void solve(int k = 0) {
  if (k == 7) {
    int ex[7];
    int ngr[3] = {};
    for (int i = 0; i < 7; ++i) ngr[cp[i]]++;
    for (int i = 0; i < 3; ++i)
      if (ngr[i] == 0) return;
    for (int i = 0; i < 7; ++i) ex[i] = pts[cp[i]] / ngr[cp[i]];
    int maxex = -1, minex = INF;
    for (int i = 0; i < 7; ++i) {
      if (maxex < ex[i]) maxex = ex[i];
      if (minex > ex[i]) minex = ex[i];
    }
    double cdif = maxex - minex;
    int cs = 0;
    for (int i = 0; i < (int(s.size())); ++i)
      if (cp[s[i].first] == cp[s[i].second]) ++cs;
    if (cdif < bdif || (cdif == bdif && cs > bs)) bdif = cdif, bs = cs;
  } else {
    for (int i = 0; i < 3; ++i) {
      cp[k] = i;
      solve(k + 1);
    }
  }
}
int main() {
  for (int i = 0; i < n; ++i) names.push_back(string(cnames[i]));
  int k;
  cin >> k;
  while (k--) {
    string n1, n2;
    cin >> n1 >> n2 >> n2;
    s.push_back(make_pair(id(n1), id(n2)));
  }
  cin >> pts[0] >> pts[1] >> pts[2];
  solve();
  cout << bdif << ' ' << bs << endl;
  return 0;
}
