#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, m, s = 0;
  long long int cost = 0;
  cin >> a >> b >> c >> m;
  vector<long long int> vu, vp, vb;
  string st;
  int p;
  for (int i = 0; i < m; i++) {
    cin >> p;
    cin >> st;
    if (st[0] == 'U') {
      vu.push_back(p);
    } else {
      vp.push_back(p);
    }
  }
  sort(vu.begin(), vu.end());
  sort(vp.begin(), vp.end());
  int lu = vu.size();
  int lp = vp.size();
  for (int i = 0; i < a && i < lu; i++) {
    cost += vu[i];
    s++;
  }
  for (int i = 0; i < b && i < lp; i++) {
    cost += vp[i];
    s++;
  }
  for (int i = a; i < vu.size(); i++) {
    vb.push_back(vu[i]);
  }
  for (int i = b; i < vp.size(); i++) {
    vb.push_back(vp[i]);
  }
  sort(vb.begin(), vb.end());
  int lb = vb.size();
  for (int i = 0; i < c && i < lb; i++) {
    cost += vb[i];
    s++;
  }
  cout << s << " " << cost << endl;
}
