#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a, b, c;
  cin >> a >> b >> c;
  long long A = a;
  long long B = b;
  vector<long long> usb;
  vector<long long> ps;
  long long f;
  string st;
  long long d;
  cin >> d;
  while (d--) {
    cin >> f >> st;
    if (st == "USB")
      usb.push_back(f);
    else
      ps.push_back(f);
  }
  sort(usb.begin(), usb.end());
  sort(ps.begin(), ps.end());
  long long i = 0, j = 0;
  long long cost = 0;
  long long t = 0;
  while (a > 0 && i < usb.size()) {
    cost = cost + usb[i];
    i++;
    a--;
    t++;
  }
  while (b > 0 && j < ps.size()) {
    cost = cost + ps[j];
    j++;
    b--;
    t++;
  }
  while (c > 0 && j < ps.size() && i < usb.size()) {
    if (c == 0)
      break;
    else {
      if (ps[j] >= usb[i]) {
        cost = cost + usb[i];
        i++;
        c--;
      } else {
        cost = cost + ps[j];
        j++;
        c--;
      }
    }
    t++;
  }
  while (c > 0 && i < usb.size()) {
    cost = cost + usb[i];
    i++;
    c--;
    t++;
  }
  while (c > 0 && j < ps.size()) {
    cost = cost + ps[j];
    j++;
    c--;
    t++;
  }
  cout << t << " " << cost << endl;
  return 0;
}
