#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int a, b, c, m;
  cin >> a >> b >> c >> m;
  vector<long long int> usb;
  vector<long long int> p;
  for (long long int i = 0; i < m; i++) {
    string s;
    long long int x;
    cin >> x >> s;
    if (s == "USB")
      usb.push_back(x);
    else
      p.push_back(x);
  }
  sort(usb.begin(), usb.end());
  sort(p.begin(), p.end());
  long long int pos1 = 0, pos2 = 0, sum = 0, cnt = 0;
  for (int i = 0; i < usb.size() && i < a; i++) {
    sum += usb[i];
    pos1 = i + 1;
    cnt++;
  }
  for (int i = 0; i < p.size() && i < b; i++) {
    sum += p[i];
    pos2 = i + 1;
    cnt++;
  }
  if (pos1 < usb.size() && pos2 < p.size()) {
    long long int cnt2 = 0;
    while (pos1 < usb.size() && pos2 < p.size() && cnt2 < c) {
      if (usb[pos1] <= p[pos2]) {
        sum += usb[pos1];
        cnt++;
        cnt2++;
        pos1++;
      } else {
        sum += p[pos2];
        cnt++;
        cnt2++;
        pos2++;
      }
    }
    while (pos1 < usb.size() && cnt2 < c) {
      sum += usb[pos1];
      cnt++;
      cnt2++;
      pos1++;
    }
    while (pos2 < p.size() && cnt2 < c) {
      sum += p[pos2];
      cnt++;
      cnt2++;
      pos2++;
    }
  } else if (pos1 < usb.size()) {
    long long int cnt2 = 0;
    while (pos1 < usb.size() && cnt2 < c) {
      sum += usb[pos1];
      cnt++;
      cnt2++;
      pos1++;
    }
  } else if (pos2 < p.size()) {
    long long int cnt2 = 0;
    while (pos2 < p.size() && cnt2 < c) {
      sum += p[pos2];
      cnt++;
      cnt2++;
      pos2++;
    }
  }
  cout << cnt << " " << sum;
}
