#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-8;
const long double PI = 3.1415926535897932384626433832795;
const string NAME[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                       "Dracul", "Snowy",  "Hexadecimal"};
map<string, int> m;
bool g[10][10];
int a[3], DIFF = INF, NUM = -INF, p[10], num[5];
void gen(int pos) {
  if (pos == 7) {
    if (num[0] == 0) return;
    if (num[1] == 0) return;
    if (num[2] == 0) return;
    int maxV = -INF, minV = INF;
    for (int i = 0; i < (int)(7); i++) {
      int score = a[p[i]] / num[p[i]];
      maxV = max(maxV, score);
      minV = min(minV, score);
    }
    int sum = 0;
    for (int i = 0; i < (int)(7); i++)
      for (int j = 0; j < (int)(7); j++)
        if (p[i] == p[j] && g[i][j]) sum++;
    if (DIFF > maxV - minV || (DIFF == maxV - minV && NUM < sum)) {
      NUM = sum;
      DIFF = maxV - minV;
    }
    return;
  }
  for (int i = 0; i < (int)(3); i++) {
    p[pos] = i;
    num[i]++;
    gen(pos + 1);
    num[i]--;
  }
}
int main() {
  for (int i = 0; i < (int)(7); i++) m[NAME[i]] = i;
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    string n1, n2, tmp;
    cin >> n1 >> tmp >> n2;
    g[m[n1]][m[n2]] = true;
  }
  for (int i = 0; i < (int)(3); i++) cin >> a[i];
  gen(0);
  cout << DIFF << " " << NUM << endl;
  return 0;
}
