#include <bits/stdc++.h>
using std::abs;
using std::bitset;
using std::cerr;
using std::cin;
using std::copy;
using std::cout;
using std::deque;
using std::endl;
using std::fill;
using std::fixed;
using std::greater;
using std::iota;
using std::istream;
using std::lower_bound;
using std::make_pair;
using std::make_tuple;
using std::map;
using std::max;
using std::max_element;
using std::min;
using std::min_element;
using std::multiset;
using std::next_permutation;
using std::nth_element;
using std::ostream;
using std::pair;
using std::priority_queue;
using std::queue;
using std::reverse;
using std::rotate;
using std::set;
using std::sort;
using std::string;
using std::swap;
using std::tie;
using std::tuple;
using std::unique;
using std::unordered_map;
using std::unordered_set;
using std::upper_bound;
using std::vector;
long long rnd(long long x, long long y) {
  static auto gen = std::bind(std::uniform_int_distribution<long long>(),
                              std::mt19937(960172));
  return gen() % (y - x + 1) + x;
}
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
template <typename T>
T sqr(T const& a) {
  return a * a;
}
int const INF = 100 + (int)1e9;
long long const INFL = 100 + (long long)1e18;
long double const PI = 3.1415926535897932384626433832795028;
void solve() {
  vector<string> const hs = {"Anka",   "Chapay", "Cleo",       "Troll",
                             "Dracul", "Snowy",  "Hexadecimal"};
  int qq;
  cin >> qq;
  int n = hs.size();
  vector<vector<int>> z(n, vector<int>(n));
  while (qq--) {
    string a, b, c;
    cin >> a >> b >> c;
    int i = 0;
    while (hs[i] != a) ++i;
    int j = 0;
    while (hs[j] != c) ++j;
    ++z[i][j];
  }
  int A, B, C;
  cin >> A >> B >> C;
  int three = 1;
  for (int i = 0; i < n; ++i) three *= 3;
  int diff = 2 * INF;
  int sym = 0;
  for (int mask = 0; mask < three; ++mask) {
    int val = mask;
    vector<int> who(n), cnt(3);
    for (int i = 0; i < n; ++i) {
      int x = val % 3;
      val /= 3;
      who[i] = x;
      ++cnt[x];
    }
    if (!cnt[0] || !cnt[1] || !cnt[2]) continue;
    int a = A / cnt[0], b = B / cnt[1], c = C / cnt[2];
    int cdiff = max({a, b, c}) - min({a, b, c});
    int csym = 0;
    for (int x = 0; x < n; ++x)
      for (int y = 0; y < n; ++y) csym += z[x][y] * (who[x] == who[y]);
    if (cdiff < diff || (cdiff == diff && csym > sym)) {
      diff = cdiff;
      sym = csym;
    }
  }
  cout << diff << " " << sym << endl;
}
int main() {
  cout.precision(15);
  cout << fixed;
  cerr.precision(6);
  cerr << fixed;
  solve();
}
