#include <bits/stdc++.h>
using namespace std;
long m, l, o;
int t[7];
long long ans = 2e9;
bool liking[7][7];
int point = 0;
long _max, _min;
int team(int p) {
  if (p == 7) {
    int tm = 0, q[3];
    memset(q, 0, sizeof(q));
    for (int i = 0; i < 7; i++) q[t[i]]++;
    if (q[0] * q[1] * q[2] == 0) return 0;
    _max = max(m / q[0], max(l / q[1], o / q[2]));
    _min = min(m / q[0], min(l / q[1], o / q[2]));
    for (int i = 0; i < 7; i++)
      for (int j = 0; j < 7; j++)
        if (t[i] == t[j] && liking[i][j]) tm++;
    if (_max - _min < ans || _max - _min == ans && point < tm) {
      ans = _max - _min;
      point = tm;
    }
    return 0;
  }
  for (int j = 0; j < 3; j++) {
    t[p] = j;
    team(p + 1);
  }
  return 0;
}
int mens(string men) {
  if (men == "Anka") return 0;
  if (men == "Chapay") return 1;
  if (men == "Cleo") return 2;
  if (men == "Troll") return 3;
  if (men == "Dracul") return 4;
  if (men == "Snowy") return 5;
  return 6;
}
int main() {
  int n, tmp, ret = 0;
  string trush, does, be;
  memset(liking, 0, sizeof(liking));
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> does >> trush >> be;
    liking[mens(does)][mens(be)] = 1;
  }
  cin >> m >> l >> o;
  team(0);
  cout << ans << " " << point << endl;
  return 0;
}
