#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> liking(7);
map<string, long long> mp;
vector<long long> demon(3);
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  mp["Anka"] = 0;
  mp["Chapay"] = 1;
  mp["Cleo"] = 2;
  mp["Troll"] = 3;
  mp["Dracul"] = 4;
  mp["Snowy"] = 5;
  mp["Hexadecimal"] = 6;
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    string a, b, c;
    cin >> a >> b >> c;
    liking[mp[a]].push_back(mp[c]);
  }
  cin >> demon[0] >> demon[1] >> demon[2];
  long long ar[7] = {0};
  long long mi = 1e18;
  long long ma_like = 0;
  for (long long i = 0; i < pow(3, 8); i++) {
    long long carry = 1;
    for (long long i = 0; i < 7; i++) {
      ar[i] = ar[i] + carry;
      carry = ar[i] / 3;
      ar[i] = ar[i] % 3;
    }
    map<long long, vector<long long>> check;
    for (long long i = 0; i < 7; i++) {
      check[ar[i]].push_back(i);
    }
    if (check[0].size() == 0 || check[1].size() == 0 || check[2].size() == 0) {
      continue;
    }
    long long points[3];
    for (long long i = 0; i < 3; i++) {
      points[i] = demon[i] / check[i].size();
    }
    long long ma = 0;
    ma = max(abs(points[0] - points[1]),
             max(abs(points[0] - points[2]), abs(points[1] - points[2])));
    if (ma == mi) {
      mi = ma;
      long long cnt = 0;
      for (long long dd = 0; dd < 3; dd++) {
        for (long long i = 0; i < check[dd].size(); i++) {
          for (long long j = 0; j < check[dd].size(); j++) {
            for (auto x : liking[check[dd][i]]) {
              if (x == check[dd][j]) {
                cnt++;
              }
            }
          }
        }
      }
      ma_like = max(ma_like, cnt);
    }
    if (ma < mi) {
      mi = ma;
      long long cnt = 0;
      for (long long dd = 0; dd < 3; dd++) {
        for (long long i = 0; i < check[dd].size(); i++) {
          for (long long j = 0; j < check[dd].size(); j++) {
            for (auto x : liking[check[dd][i]]) {
              if (x == check[dd][j]) {
                cnt++;
              }
            }
          }
        }
      }
      ma_like = cnt;
    }
  }
  cout << mi << " " << ma_like;
}
