#include <bits/stdc++.h>
using namespace std;
int a, b, c, m;
vector<long long> usp, ps2, both;
long long val;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b >> c >> m;
  while (m--) {
    cin >> val >> s;
    if (s[0] == 'U')
      usp.push_back(val);
    else
      ps2.push_back(val);
  }
  long long res, count;
  res = count = 0;
  int x = 0;
  sort(usp.begin(), usp.end());
  for (int i = 0; i < a && i < usp.size(); ++i, ++x) {
    count++;
    res += usp[i];
  }
  int y = 0;
  sort(ps2.begin(), ps2.end());
  for (int i = 0; i < b && i < ps2.size(); ++i, ++y) {
    count++;
    res += ps2[i];
  }
  for (int i = x; i < usp.size(); ++i) both.push_back(usp[i]);
  for (int i = y; i < ps2.size(); ++i) both.push_back(ps2[i]);
  sort(both.begin(), both.end());
  for (int i = 0; i < both.size() && i < c; ++i) {
    res += both[i];
    count++;
  }
  cout << count << ' ' << res;
}
