#include <bits/stdc++.h>
using namespace std;
int a, b, c, A[300100], B[300100], m, n1, n2, C[300100];
char S[300];
int main() {
  scanf("%d %d %d %d", &a, &b, &c, &m);
  int p1 = 0, p2 = 0;
  for (int i = 1; i <= m; i++) {
    int x;
    scanf("%d", &x);
    cin >> S;
    if (S[0] == 'U')
      A[++n1] = x;
    else
      B[++n2] = x;
  }
  sort(A + 1, A + n1 + 1);
  sort(B + 1, B + n2 + 1);
  int ans = 0;
  long long sum = 0;
  for (int i = 1; i <= min(a, n1); i++) {
    ans++;
    sum += (long long)A[i];
  }
  for (int i = 1; i <= min(b, n2); i++) {
    ans++;
    sum += (long long)B[i];
  }
  m = 0;
  for (int i = min(a, n1) + 1; i <= n1; i++) C[++m] = A[i];
  for (int i = min(b, n2) + 1; i <= n2; i++) C[++m] = B[i];
  sort(C + 1, C + m + 1);
  for (int i = 1; i <= min(m, c); i++) {
    ans++;
    sum += (long long)C[i];
  }
  printf("%d %I64d", ans, sum);
}
