#include <bits/stdc++.h>
using namespace std;
string name[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                 "Dracul", "Snowy",  "Hexadecimal"};
map<string, int> tab;
bool G[10][10];
int belong[10], A[3];
int power[30];
int N, minDiff, maxLike;
void dp(int k) {
  if (k == 7) {
    if (A[0] * A[1] * A[2] == 0) return;
    int p = power[0] / A[0];
    int q = power[1] / A[1];
    int r = power[2] / A[2];
    int maxd = max(p, max(q, r));
    int mind = min(p, min(q, r));
    int maxlike = 0;
    for (int i = 0; i < 7; ++i)
      for (int j = 0; j < 7; ++j)
        if (G[i][j] && (belong[i] == belong[j])) {
          ++maxlike;
        }
    if ((maxd - mind < minDiff) ||
        (maxd - mind == minDiff) && (maxlike > maxLike)) {
      minDiff = maxd - mind;
      maxLike = maxlike;
    }
    return;
  }
  for (int i = 0; i < 3; ++i) {
    belong[k] = i;
    ++A[i];
    dp(k + 1);
    --A[i];
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < 7; ++i) tab[name[i]] = i;
  for (int i = 0; i < N; ++i) {
    char ha[20], hb[20];
    scanf("%s%s%s", ha, hb, hb);
    int a = tab[string(ha)];
    int b = tab[string(hb)];
    G[a][b] = 1;
  }
  for (int i = 0; i < 3; ++i) scanf("%d", &power[i]);
  maxLike = 0, minDiff = max(power[0], max(power[1], power[2]));
  dp(0);
  printf("%d %d\n", minDiff, maxLike);
  return 0;
}
