#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod = (1000000007LL)) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
const int INF = 150;
int n, red[20], blue[20], DP[1 << 16][2][INF + 2];
char card[20];
int dp(int mask, bool red_empty, int other) {
  int bought_red = 0, bought_blue = 0;
  for (int i = 0; i < n; i++)
    if ((mask >> i) & 1) {
      if (card[i] == 'R')
        bought_red++;
      else
        bought_blue++;
    }
  if (bought_red + bought_blue == n) return 0;
  int &ans = DP[mask][red_empty][other];
  if (ans != -1) return ans;
  ans = (1000000007LL);
  for (int i = 0; i < n; i++) {
    if ((mask >> i) & 1) continue;
    int red_price = max(0, red[i] - bought_red);
    int blue_price = max(0, blue[i] - bought_blue);
    int red_prev = 0, blue_prev = 0;
    if (red_empty)
      blue_prev = other;
    else
      red_prev = other;
    int red_needed = max(0, red_price - red_prev);
    int blue_needed = max(0, blue_price - blue_prev);
    int tokens = max(red_needed, blue_needed);
    int new_red = red_prev + tokens - red_price;
    int new_blue = blue_prev + tokens - blue_price;
    if (new_red == 0)
      ans = min(ans, tokens + dp(mask | (1 << i), true, min(INF, new_blue)));
    else
      ans = min(ans, tokens + dp(mask | (1 << i), false, min(INF, new_red)));
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int need_red = 0, need_blue = 0;
  for (int i = 0; i < n; i++) {
    cin >> card[i] >> red[i] >> blue[i];
    need_red += max(0, red[i] - n);
    need_blue += max(0, blue[i] - n);
    red[i] = min(red[i], n);
    blue[i] = min(blue[i], n);
  }
  memset(DP, -1, sizeof(DP));
  int ans = n + max(need_red, need_blue);
  if (need_red > need_blue)
    ans += dp(0, true, min(INF, need_red - need_blue));
  else
    ans += dp(0, false, min(INF, need_blue - need_red));
  cout << ans;
  return 0;
}
