#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const string H[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                    "Dracul", "Snowy",  "Hexadecimal"};
int n;
bool g[7][7];
vector<int> p;
long long x[3];
vector<int> gr[3];
void solution() {
  cin >> n;
  for (int i = 0, _n = (n); i < _n; ++i) {
    string a, b;
    cin >> a;
    cin >> b;
    cin >> b;
    int p = find(H, H + 7, a) - H;
    int q = find(H, H + 7, b) - H;
    g[p][q] = 1;
  }
  long long Diff = -1, Likes = -1;
  for (int i = 0, _n = (3); i < _n; ++i) cin >> x[i];
  for (int i0 = 0; i0 <= 2; i0++)
    for (int i1 = 0; i1 <= 2; i1++)
      for (int i2 = 0; i2 <= 2; i2++)
        for (int i3 = 0; i3 <= 2; i3++)
          for (int i4 = 0; i4 <= 2; i4++)
            for (int i5 = 0; i5 <= 2; i5++)
              for (int i6 = 0; i6 <= 2; i6++) {
                gr[0].clear();
                gr[1].clear();
                gr[2].clear();
                gr[i0].push_back(0);
                gr[i1].push_back(1);
                gr[i2].push_back(2);
                gr[i3].push_back(3);
                gr[i4].push_back(4);
                gr[i5].push_back(5);
                gr[i6].push_back(6);
                if (gr[0].empty() || gr[1].empty() || gr[2].empty()) continue;
                long long mini = -1, maxi = -1;
                int likes = 0;
                for (int i = 0, _n = (3); i < _n; ++i) {
                  long long exp = x[i] / (int)((gr[i]).size());
                  for (int j = 0, _n = ((int)((gr[i]).size())); j < _n; ++j)
                    for (int k = 0; k < (int)((gr[i]).size()); k++)
                      likes += g[gr[i][j]][gr[i][k]];
                  if (mini == -1 || mini > exp) mini = exp;
                  if (maxi == -1 || maxi < exp) maxi = exp;
                }
                long long diff = maxi - mini;
                if (Diff == -1 || (diff < Diff) ||
                    (diff == Diff && likes > Likes))
                  Diff = diff, Likes = likes;
              }
  cout << Diff << " " << Likes << endl;
}
int main() {
  solution();
  return 0;
}
