#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using iii = tuple<ll, ll, ll>;
using matrix = vector<vector<ll>>;
using arr = vector<ll>;
using vs = vector<string>;
using pv = vector<ii>;
using umap = unordered_map<ll, ll>;
void showArr(arr a) {
  for (auto i : a) cout << i << " ";
  cout << endl;
}
ll dx[] = {-1, 1, -1, 1, 0, 0, -1, 1};
ll dy[] = {-1, 1, 0, 0, -1, 1, 1, -1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(25);
  ll a, b, c;
  cin >> a >> b >> c;
  ll m;
  cin >> m;
  arr u, ps;
  for (int i = 0; i < m; i++) {
    ll p;
    string s;
    cin >> p >> s;
    if (s == "USB") {
      u.push_back(p);
    } else {
      ps.push_back(p);
    }
  }
  sort(u.begin(), u.end(), [](ll x, ll y) -> bool { return x > y; });
  sort(ps.begin(), ps.end(), [](ll x, ll y) -> bool { return x > y; });
  ll price = 0, number = 0;
  while (u.size() > 0 and --a >= 0) {
    number++;
    price += u.back();
    u.pop_back();
  }
  while (ps.size() > 0 and --b >= 0) {
    number++;
    price += ps.back();
    ps.pop_back();
  }
  while ((ps.size() > 0 and u.size() > 0) and --c >= 0) {
    number++;
    if (ps.back() > u.back()) {
      price += u.back();
      u.pop_back();
    } else {
      price += ps.back();
      ps.pop_back();
    }
  }
  while (ps.size() > 0 and --c >= 0) {
    number++;
    price += ps.back();
    ps.pop_back();
  }
  while (u.size() > 0 and --c >= 0) {
    number++;
    price += u.back();
    u.pop_back();
  }
  cout << number << " " << price << endl;
  return 0;
}
