#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  int m;
  scanf("%d", &m);
  string s;
  int val, ans = 0;
  vector<int> u, p;
  for (int i = 0; i < int(m); i++) {
    cin >> val >> s;
    if (s[0] == 'U')
      u.push_back(val);
    else
      p.push_back(val);
  }
  long long sum = 0;
  sort(u.begin(), u.end());
  sort(p.begin(), p.end());
  int i = 0;
  while (i < int(u.size()) && a) {
    sum += u[i];
    i++;
    a--;
    ans++;
  }
  int j = 0;
  while (j < int(p.size()) && b) {
    sum += p[j];
    j++;
    b--;
    ans++;
  }
  while (i < int(u.size()) || j < int(p.size())) {
    if (!c) break;
    c--;
    ans++;
    if (i == int(u.size()))
      sum += p[j++];
    else if (j == int(p.size()))
      sum += u[i++];
    else {
      if (u[i] < p[j])
        sum += u[i++];
      else
        sum += p[j++];
    }
  }
  cout << ans << ' ' << sum << endl;
  return 0;
}
