#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  cin >> a >> b >> c;
  long long d, e, f;
  d = a;
  e = b;
  f = c;
  long long m;
  cin >> m;
  vector<long long> usb;
  vector<long long> pst;
  long long ff;
  string str;
  long long g = 0;
  for (g; g < m; ++g) {
    cin >> ff >> str;
    if (str == "USB") {
      usb.push_back(ff);
    } else {
      pst.push_back(ff);
    }
  }
  sort(usb.begin(), usb.end());
  sort(pst.begin(), pst.end());
  long long one, two, three;
  one = two = three = 0;
  long long i = 0;
  while (i < usb.size() && a > 0) {
    one += usb.at(i);
    i++;
    a--;
  }
  long long j = 0;
  while (j < pst.size() && b > 0) {
    two += pst.at(j);
    j++;
    b--;
  }
  while (c > 0 && (i < usb.size() || j < pst.size())) {
    if (i >= usb.size() && j < pst.size()) {
      three += pst.at(j);
      c--;
      j++;
    } else if (i < usb.size() && j >= pst.size()) {
      three += usb.at(i);
      c--;
      i++;
    } else if (i < usb.size() && j < pst.size()) {
      if (usb.at(i) < pst.at(j)) {
        three += usb.at(i);
        c--;
        i++;
      } else {
        three += pst.at(j);
        c--;
        j++;
      }
    }
  }
  cout << (d - a) + (e - b) + (f - c) << " ";
  cout << one + two + three << endl;
  return 0;
}
