#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
bool solve() {
  unsigned long long int a, b, c;
  cin >> a >> b >> c;
  unsigned long long int m(0);
  cin >> m;
  vector<int> U, P;
  for (int i = 0; i < m; i++) {
    unsigned long long int price;
    cin >> price;
    string type;
    cin >> type;
    if (type[0] == 'U') {
      U.push_back(price);
    } else
      P.push_back(price);
  }
  sort((P.begin()), (P.end()));
  sort((U.begin()), (U.end()));
  unsigned long long int ans(0), count(0);
  int u = (int)U.size();
  int p = (int)P.size();
  int ind1(0), ind2(0);
  for (int i(0); i < min(u, (int)a); i++) {
    count++;
    ans += U[i];
    ind1 = i + 1;
  }
  for (int i(0); i < min(p, (int)b); i++) {
    count++;
    ans += P[i];
    ind2 = i + 1;
  }
  vector<int> Ob;
  Ob.insert(Ob.end(), U.begin() + ind1, U.end());
  Ob.insert(Ob.end(), P.begin() + ind2, P.end());
  sort((Ob.begin()), (Ob.end()));
  for (int i(0); i < min((int)c, (int)Ob.size()); i++) {
    count++;
    ans += Ob[i];
  }
  cout << count << " " << ans;
  return 1;
}
int main() {
  solve();
  return 0;
}
