\begin{problem}{Asynchronous Processor}{standard input}{standard output}{2 seconds}{1024 megabytes}

You are given a program consisting of $n$ instructions executed by a processor with a single integer register~$A$, initially equal to $0$. Each instruction is one of two types:
\begin{shortitems}
    \item ``\texttt{+ v}'' --- performs $A := A + v$;
    \item ``\texttt{= v}'' --- performs $A := v$.
\end{shortitems}

The instructions in the program are numbered from $1$ to $n$. Each instruction $i$ initially has timestamp $i$.

Some instructions are marked as \textit{asynchronous}. If instruction $i$ is asynchronous, its timestamp can be changed to any \textbf{real} number greater than $i$.

After all timestamp adjustments, all timestamps must be distinct. The processor then executes the instructions in order of increasing timestamp.

Determine the number of distinct final values of $A$ that can be obtained after all instructions have been executed, considering all possible choices of asynchronous instruction timestamps.

\InputFile
The first line contains an integer $n$, denoting the number of instructions in the program ($1 \le n \le 2000$).

The $i$-th of the following $n$ lines describes instruction $i$ and contains three tokens. The first token is either `\texttt{+}' or `\texttt{=}', denoting the type of the instruction. The second token is an integer $v$, denoting the argument of the instruction ($1 \le v \le 500$). Finally, the third token is either ``\texttt{async}'' if the instruction is marked as asynchronous, or ``\texttt{sync}'' otherwise.

\OutputFile
Print the number of distinct final values $A$ can take after executing the program. 

\Examples

\begin{example}
\exmpfile{example.01}{example.01.a}%
\exmpfile{example.02}{example.02.a}%
\end{example}

\Note
In the first test, the program execution starts with instruction $1$ setting $A$ to $1$. Then, instructions $2$~and~$3$ are executed in one of the two orders:
\begin{shortitems}
\item if ``\texttt{= 2}'' is executed before ``\texttt{+ 3}'', $A$ will be equal to $5$;
\item if ``\texttt{+ 3}'' is executed before ``\texttt{= 2}'', $A$ will be equal to $2$.
\end{shortitems}
Thus, there are two possible values of $A$ at the end: $5$ and $2$.


\end{problem}

