#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  set<pair<string, string> > likes;
  for (int i = (0); i < ((n)); ++i) {
    string a, b, c;
    cin >> a >> b >> c;
    likes.insert(make_pair(a, c));
  }
  long long a, b, c;
  cin >> a >> b >> c;
  long long bestDiff = -1;
  long long bestSimp = 0;
  string const NAMES[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                          "Dracul", "Snowy",  "Hexadecimal"};
  long long prices[] = {a, b, c};
  vector<int> g(7);
  for (g[0] = 0; g[0] < (3); ++g[0])
    for (g[1] = 0; g[1] < (3); ++g[1])
      for (g[2] = 0; g[2] < (3); ++g[2])
        for (g[3] = 0; g[3] < (3); ++g[3])
          for (g[4] = 0; g[4] < (3); ++g[4])
            for (g[5] = 0; g[5] < (3); ++g[5])
              for (g[6] = 0; g[6] < (3); ++g[6]) {
                long long simp = 0;
                long long diff = 0;
                vector<int> team[3];
                for (int i = (0); i < (((int)g.size())); ++i)
                  team[g[i]].push_back(i);
                if (!team[0].empty() && !team[1].empty() && !team[2].empty()) {
                  vector<int> a(3);
                  for (int i = (0); i < ((3)); ++i)
                    a[i] = prices[i] / (int)team[i].size();
                  sort(a.begin(), a.end());
                  diff = a.back() - a.front();
                  long long cur = 0;
                  for (int i = (0); i < ((3)); ++i) {
                    for (int j = (0); j < (((int)team[i].size())); ++j)
                      for (int k = (0); k < (((int)team[i].size())); ++k)
                        if (likes.count(make_pair(NAMES[team[i][j]],
                                                  NAMES[team[i][k]]))) {
                          ++cur;
                        }
                  }
                  simp = max(simp, cur);
                  if (bestDiff == -1 || bestDiff > diff ||
                      bestDiff == diff && bestSimp < simp) {
                    bestDiff = diff;
                    bestSimp = simp;
                  }
                }
              }
  cout << bestDiff << " " << bestSimp << endl;
  return 0;
}
