#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c;
  cin >> a >> b >> c;
  long long int n;
  cin >> n;
  vector<long long int> usb, ps;
  long long int val;
  string name;
  for (long int i = 0; i < n; i++) {
    cin >> val >> name;
    if (name == "USB") {
      usb.push_back(val);
    } else {
      ps.push_back(val);
    }
  }
  long long int cnt = 0, cost = 0;
  sort(usb.begin(), usb.end());
  sort(ps.begin(), ps.end());
  long int ui = 0, pi = 0, uk = usb.size(), pk = ps.size();
  for (long int i = 0; i < a; i++) {
    if (i < uk) {
      cnt++;
      cost += usb[ui++];
    } else {
      break;
    }
  }
  for (long int i = 0; i < b; i++) {
    if (i < pk) {
      cnt++;
      cost += ps[pi++];
    } else {
      break;
    }
  }
  for (long int i = 0; i < c; i++) {
    if (ui < uk || pi < pk) {
      if (ui < uk && pi < pk) {
        if (usb[ui] <= ps[pi]) {
          cost += usb[ui++];
        } else {
          cost += ps[pi++];
        }
      } else if (ui < uk) {
        cost += usb[ui++];
      } else {
        cost += ps[pi++];
      }
      cnt++;
    } else {
      break;
    }
  }
  cout << cnt << " " << cost;
  return 0;
}
