#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    long long int a, b, c, y = 0, x;
    cin >> a >> b >> c;
    long long int m;
    cin >> m;
    vector<pair<long long int, long long int>> v;
    string s;
    for (long long int i = 0; i < m; i++) {
      cin >> x >> s;
      if (s[0] == 'U') {
        v.push_back({x, 1});
      } else
        v.push_back({x, 0});
    }
    x = 0;
    sort(v.begin(), v.end());
    for (long long int i = 0; i < m; i++) {
      if (a && v[i].second) {
        a--;
      } else if (b && !v[i].second) {
        b--;
      } else if (c) {
        c--;
      } else {
        continue;
      }
      y++;
      x += v[i].first;
    }
    cout << y << " " << x << endl;
  }
  return 0;
}
