#include <bits/stdc++.h>
using namespace std;
long long int a, b, c, val, n;
string s;
priority_queue<long long int, vector<long long int>, greater<long long int>> q;
priority_queue<long long int, vector<long long int>, greater<long long int>> p;
int main() {
  cin >> a >> b >> c;
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    cin >> val >> s;
    if (s == "PS/2") {
      q.push(val);
    } else
      p.push(val);
  }
  long long int ans = 0, sum = 0;
  while (a && !p.empty()) {
    long long int t = p.top();
    p.pop();
    sum += t;
    ans++;
    a--;
  }
  while (b && !q.empty()) {
    long long int t = q.top();
    q.pop();
    sum += t;
    ans++;
    b--;
  }
  while (c && (!q.empty() || !p.empty())) {
    long long int t = INT_MAX;
    if (!q.empty()) {
      t = min(t, q.top());
    }
    if (!p.empty()) {
      t = min(t, p.top());
    }
    if (!q.empty() && t == q.top()) {
      q.pop();
      sum += t;
      ans++;
    } else if (!p.empty() && t == p.top()) {
      p.pop();
      sum += t;
      ans++;
    }
    c--;
  }
  cout << ans << ' ' << sum << endl;
  return 0;
}
