#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long int a, cost, b, m, c, ans = 0, i, j, ps, u, psu;
  cin >> a >> b >> c;
  cin >> m;
  string second;
  vector<long long int> v, v1;
  for (i = 1; i < 1 + m; i++) {
    cin >> cost;
    cin >> second;
    if (second[0] == 'U') {
      v.push_back(cost);
    } else {
      v1.push_back(cost);
    }
  }
  long long int count = 0;
  sort((v).begin(), (v).end());
  sort((v1).begin(), (v1).end());
  long long int temp = v.size();
  u = min(temp, a);
  temp = v1.size();
  ps = min(temp, b);
  for (i = 0; i < u; i++) {
    count++;
    ans += v[i];
  }
  for (i = 0; i < ps; i++) {
    count++;
    ans += v1[i];
  }
  vector<long long int> v2;
  for (i = u; i < v.size(); i++) {
    v2.push_back(v[i]);
  }
  for (i = ps; i < v1.size(); i++) {
    v2.push_back(v1[i]);
  }
  sort((v2).begin(), (v2).end());
  temp = v2.size();
  psu = min(temp, c);
  for (i = 0; i < psu; i++) {
    count++;
    ans += v2[i];
  }
  cout << count << " " << ans;
}
