#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
vector<long long int> v, v1;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b, c;
  cin >> a >> b >> c;
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    long long int val;
    string type;
    cin >> val >> type;
    if (type == "USB") {
      v.push_back(val);
    } else {
      v1.push_back(val);
    }
  }
  int si = v.size(), sii = v1.size();
  sort(v.begin(), v.end());
  sort(v1.begin(), v1.end());
  long long int ans = 0, ans1 = 0, i = 0, j = 0, t = 0;
  while (i < si && i < a) {
    ans++;
    ans1 += v[i++];
  }
  while (j < sii && j < b) {
    ans++;
    ans1 += v1[j++];
  }
  while (t < c) {
    if (i >= si && j >= sii) {
      break;
    } else if (i < si && j < sii) {
      if (v[i] > v1[j]) {
        ans++;
        ans1 += v1[j];
        j++;
      } else {
        ans++;
        ans1 += v[i];
        i++;
      }
    } else if (i < si) {
      ans++;
      ans1 += v[i];
      i++;
    } else {
      ans++;
      ans1 += v1[j];
      j++;
    }
    t++;
  }
  cout << ans << " " << ans1 << "\n";
}
