#include <bits/stdc++.h>
using namespace std;
int inline id(string s) {
  int x;
  if (s == "Anka")
    x = 0;
  else if (s == "Chapay")
    x = 1;
  else if (s == "Cleo")
    x = 2;
  else if (s == "Troll")
    x = 3;
  else if (s == "Dracul")
    x = 4;
  else if (s == "Snowy")
    x = 5;
  else
    x = 6;
  return x;
}
int Adj[7][7];
inline void print_bin(int x) {
  for (int i = 0; i < 7; i++) printf("%d", (x & (1 << i)) ? 1 : 0);
  printf("\n");
}
int ones[1 << 7];
inline int get(int x) {
  int ret = 0;
  for (int i = 0; i < 7; i++) {
    if (x & (1 << i)) {
      for (int j = 0; j < 7; j++) {
        if (i == j) continue;
        if (x & (1 << j)) {
          ret += Adj[i][j];
        }
      }
    }
  }
  return ret;
}
int main() {
  ones[0] = 0;
  for (int i = 1; i < (1 << 7); i++) ones[i] = ones[i >> 1] + (i & 1);
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    int id1 = id(s1);
    int id2 = id(s3);
    Adj[id1][id2] = 1;
  }
  int A, B, C;
  cin >> A >> B >> C;
  int maxl = 0;
  int mind = 2000000011;
  for (int msk = 1; msk < (1 << 7); msk++) {
    for (int msk2 = 1; msk2 < (1 << 7); msk2++) {
      if ((msk & msk2) > 0) continue;
      int msk3 = 0;
      for (int i = 0; i < 7; i++)
        if ((msk & (1 << i)) == 0 && (msk2 & (1 << i)) == 0) msk3 |= (1 << i);
      if (msk3 == 0) continue;
      int t1 = A / ones[msk];
      int t2 = B / ones[msk2];
      int t3 = C / ones[msk3];
      int like = 0;
      like += get(msk);
      like += get(msk2);
      like += get(msk3);
      int maxt = max(t1, max(t2, t3));
      int mint = min(t1, min(t2, t3));
      int diff = maxt - mint;
      if (diff < mind) {
        mind = diff;
        maxl = like;
      }
      if (diff == mind && like > maxl) {
        maxl = like;
      }
    }
  }
  printf("%d %d\n", mind, maxl);
  return 0;
}
