As a truly clever guy, bobo has never entered any kind of IQ tests. But here comes one.
The test consists of $n$ questions, which are numbered conveniently by $1, 2, \dots, n$. Each question has two options -- namely options "A" and "B". The $i$-th question is "How many questions among questions $1, 2, \dots, (i - 1)$ are answered by option $t_i$?". ($t_i$ is either "A" or "B".) Option "A" says there are $x_i$ questions while option "B" says $y_i$.
bobo soon notices that the test is poorly-designed, so he wonder how many questions he can answer correctly at most.
The first line contains an integer $n$ ($1 \leq n \leq 200000$).
Each of the following $n$ lines contains a character $t_i$ and $2$ integers $x_i, y_i$ ($t_i \in \{A, B\}, 0 \leq x_i, y_i \leq n$).
A single integer denotes the maximum number of questions he can answer correctly.