#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double eps = (1e-5);
int isGreater(long double x, long double y) {
  if (abs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
const int n = 7;
int m;
bool likes[n][n];
string hero[n] = {"Anka",   "Chapay", "Cleo",       "Troll",
                  "Dracul", "Snowy",  "Hexadecimal"};
int getID(const string &s) {
  for (int i = 0; i < n; ++i)
    if (s == hero[i]) return i;
  assert(0);
  return -1;
}
vector<int> t[3];
int ass[n];
int score[3];
int getMinDiff() {
  vector<int> v = {0, 1, 2};
  int ans = INT_MAX;
  do {
    int mx = 0, mn = INT_MAX;
    for (int i = 0; i < 3; ++i) {
      int s = score[v[i]] / (int)(t[i]).size();
      mx = max(mx, s);
      mn = min(mn, s);
    }
    ans = min(ans, mx - mn);
  } while (next_permutation(v.begin(), v.end()));
  return ans;
}
int getLiking() {
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (ass[i] == ass[j] && likes[i][j]) ans++;
    }
  }
  return ans;
}
pair<int, int> solve(int i) {
  if (i == n) {
    if (t[0].empty() || t[1].empty() || t[2].empty()) return {INT_MAX, 0};
    return {getMinDiff(), getLiking()};
  }
  pair<int, int> ans = {INT_MAX, 0};
  for (int j = 0; j < 3; ++j) {
    t[j].push_back(i);
    ass[i] = j;
    auto temp = solve(i + 1);
    if (temp.first < ans.first)
      ans = temp;
    else if (temp.first == ans.first && temp.second > ans.second)
      ans = temp;
    t[j].pop_back();
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> m;
  for (int i = 0; i < m; ++i) {
    string s1, dummy, s2;
    cin >> s1 >> dummy >> s2;
    likes[getID(s1)][getID(s2)] = true;
  }
  for (int i = 0; i < 3; ++i) cin >> score[i];
  auto ans = solve(0);
  cout << ans.first << ' ' << ans.second;
  return 0;
}
