#include <bits/stdc++.h>
using namespace std;
long long a, b, c, u[300005], p[300005], x, y, d[300005], z;
long long m;
string s;
long long sum, ans;
int main() {
  cin >> a >> b >> c;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> z >> s;
    if (s[0] == 'U')
      u[++x] = z;
    else
      p[++y] = z;
  }
  sort(u + 1, u + 1 + x);
  sort(p + 1, p + 1 + y);
  for (int i = 1; i <= a; i++) {
    if (i > x) break;
    sum += u[i];
    ans++;
  }
  for (int i = 1; i <= b; i++) {
    if (i > y) break;
    sum += p[i];
    ans++;
  }
  int t = 0;
  for (int i = a + 1; i <= x; i++) d[++t] = u[i];
  for (int i = b + 1; i <= y; i++) d[++t] = p[i];
  sort(d + 1, d + t + 1);
  for (int i = 1; i <= c; i++) {
    if (i > t) break;
    sum += d[i];
    ans++;
  }
  cout << ans << " " << sum;
  return 0;
}
