#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
int main(int argc, char *argv[]) {
  int n;
  while (scanf("%d", &n) != EOF) {
    string name[8] = {"XXXXX", "Anka",   "Chapay", "Cleo",
                      "Troll", "Dracul", "Snowy",  "Hexadecimal"};
    int number[7] = {1, 2, 3, 4, 5, 6, 7};
    string a[45];
    string b[45];
    char ch[10];
    for (int i = 0; i < n; i++) cin >> a[i] >> ch >> b[i];
    int b1, b2, b3;
    cin >> b1 >> b2 >> b3;
    int ax[3];
    ax[0] = b1 / 1;
    ax[1] = b2 / 1;
    ax[2] = b3 / 5;
    sort(ax, ax + 3);
    int zuo[2][2] = {0};
    zuo[1][0] = 1;
    zuo[1][1] = 1;
    zuo[1][2] = 5;
    int temp = ax[2] - ax[0];
    for (int i = 1; i <= 5; i++) {
      for (int j = 1; j <= (7 - i - 1); j++) {
        ax[0] = b1 / i;
        ax[1] = b2 / j;
        ax[2] = b3 / (7 - i - j);
        sort(ax, ax + 3);
        if (temp > ax[2] - ax[0]) {
          temp = ax[2] - ax[0];
          zuo[1][0] = i;
          zuo[1][1] = j;
        }
        if (temp == ax[2] - ax[0]) {
          zuo[0][0] = i;
          zuo[0][1] = j;
        }
      }
    }
    int maxx = 0;
    int o;
    if (zuo[0][0] != 0)
      o = 0;
    else
      o = 1;
    for (o; o < 2; o++) {
      do {
        int sum = 0;
        for (int i = 0; i < zuo[o][0]; i++) {
          for (int j = 0; j < zuo[o][0]; j++) {
            if (j == i) continue;
            for (int k = 0; k < n; k++) {
              if (name[number[i]] == a[k] && name[number[j]] == b[k]) sum++;
            }
          }
        }
        for (int i = zuo[o][0]; i < zuo[o][0] + zuo[o][1]; i++) {
          for (int j = zuo[o][0]; j < zuo[o][0] + zuo[o][1]; j++) {
            if (j == i) continue;
            for (int k = 0; k < n; k++) {
              if (name[number[i]] == a[k] && name[number[j]] == b[k]) sum++;
            }
          }
        }
        for (int i = zuo[o][0] + zuo[o][1]; i < 7; i++) {
          for (int j = zuo[o][0] + zuo[o][1]; j < 7; j++) {
            if (j == i) continue;
            for (int k = 0; k < n; k++) {
              if (name[number[i]] == a[k] && name[number[j]] == b[k]) sum++;
            }
          }
        }
        if (maxx < sum) maxx = sum;
      } while (next_permutation(number, number + 7));
    }
    cout << temp << " " << maxx << endl;
  }
  return 0;
}
