#include <bits/stdc++.h>
using namespace std;
int main() {
  map<string, int> id;
  id["Anka"] = 0;
  id["Chapay"] = 1;
  id["Cleo"] = 2;
  id["Troll"] = 3;
  id["Dracul"] = 4;
  id["Snowy"] = 5;
  id["Hexadecimal"] = 6;
  int like[7][7];
  memset(like, 0, sizeof(like));
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    char name1[100], trash[100], name2[100];
    scanf(" %s %s %s", name1, trash, name2);
    like[id[name1]][id[name2]] = 1;
  }
  int E[3];
  scanf("%d %d %d", &E[0], &E[1], &E[2]);
  bool first = true;
  int bestDiff, bestnLikes;
  int s[7];
  for (s[0] = 0; s[0] < 3; ++s[0]) {
    for (s[1] = 0; s[1] < 3; ++s[1]) {
      for (s[2] = 0; s[2] < 3; ++s[2]) {
        for (s[3] = 0; s[3] < 3; ++s[3]) {
          for (s[4] = 0; s[4] < 3; ++s[4]) {
            for (s[5] = 0; s[5] < 3; ++s[5]) {
              for (s[6] = 0; s[6] < 3; ++s[6]) {
                int size[3];
                int nLikes = 0;
                memset(size, 0, sizeof(size));
                for (int i = 0; i < 7; ++i) {
                  ++size[s[i]];
                  for (int j = 0; j < 7; ++j) {
                    if (s[i] == s[j]) {
                      nLikes += like[i][j];
                    }
                  }
                }
                if (size[0] && size[1] && size[2]) {
                  int v[3];
                  for (int i = 0; i < 3; ++i) {
                    v[i] = E[i] / size[i];
                  }
                  int diff =
                      max(v[0], max(v[1], v[2])) - min(v[0], min(v[1], v[2]));
                  if (first == true || diff < bestDiff ||
                      (diff == bestDiff && nLikes > bestnLikes)) {
                    bestDiff = diff;
                    bestnLikes = nLikes;
                  }
                  first = false;
                }
              }
            }
          }
        }
      }
    }
  }
  printf("%d %d\n", bestDiff, bestnLikes);
  return 0;
}
