#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, m;
  cin >> a >> b >> c >> m;
  priority_queue<int> usb;
  priority_queue<int> ps2;
  for (int i = 0; i < m; i++) {
    int x;
    string s;
    cin >> x >> s;
    if (s == "USB")
      usb.push(-1 * x);
    else
      ps2.push(-1 * x);
  }
  long long counter = 0;
  long long cost = 0;
  for (int i = 0; i < a; i++) {
    if (!usb.empty()) {
      cost += (usb.top() * -1);
      counter++;
      usb.pop();
    } else
      break;
  }
  for (int i = 0; i < b; i++) {
    if (!ps2.empty()) {
      cost += (ps2.top() * -1);
      counter++;
      ps2.pop();
    } else
      break;
  }
  for (int i = 0; i < c; i++) {
    if (!usb.empty()) {
      if (!ps2.empty()) {
        if ((ps2.top() * -1) < (usb.top() * -1)) {
          counter++;
          cost += (ps2.top() * -1);
          ps2.pop();
        } else {
          counter++;
          cost += (usb.top() * -1);
          usb.pop();
        }
      } else {
        counter++;
        cost += (usb.top() * -1);
        usb.pop();
      }
    } else if (!ps2.empty()) {
      counter++;
      cost += (ps2.top() * -1);
      ps2.pop();
    } else
      break;
  }
  cout << counter << " " << cost;
  return 0;
}
