#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(339264);
const long long MOD = 998244353;
vector<string> guys = {"Anka",   "Chapay", "Cleo",       "Troll",
                       "Dracul", "Snowy",  "Hexadecimal"};
pair<int, int> opt = {2e9 + 30, 0};
int smp = 0;
int cnt[3];
int gr[7];
void brute(int i, vector<vector<int>> &symp, long long a, long long b,
           long long c) {
  if (i == 7) {
    if (cnt[0] > 0 && cnt[1] > 0 && cnt[2] > 0) {
      long long x = a / cnt[0];
      long long y = b / cnt[1];
      long long z = c / cnt[2];
      long long d = max(abs(x - y), max(abs(y - z), abs(x - z)));
      if (d < opt.first) {
        opt.first = d;
        opt.second = smp;
      } else if (d <= opt.first && opt.second < smp) {
        opt.second = smp;
      }
    }
    return;
  }
  for (int cl = 0; cl < 3; cl++) {
    gr[i] = cl;
    cnt[cl]++;
    for (int j : symp[i]) {
      if (gr[j] == gr[i]) {
        smp++;
      }
    }
    brute(i + 1, symp, a, b, c);
    for (int j : symp[i]) {
      if (gr[j] == gr[i]) {
        smp--;
      }
    }
    cnt[cl]--;
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cout << fixed << setprecision(20);
  int n;
  cin >> n;
  vector<vector<int>> symp(7);
  for (int i = 0; i < n; i++) {
    string a, b, c;
    cin >> a >> b >> c;
    int p = find(guys.begin(), guys.end(), a) - guys.begin();
    int q = find(guys.begin(), guys.end(), c) - guys.begin();
    if (p > q) {
      symp[p].push_back(q);
    } else {
      symp[q].push_back(p);
    }
  }
  long long a, b, c;
  cin >> a >> b >> c;
  brute(0, symp, a, b, c);
  cout << opt.first << " " << opt.second << endl;
  return 0;
}
