AT_abc467_b [ABC467B] Keep the Change

Description

Takahashi made purchases at $ N $ stores. Initially, he had $ 10000 $ yen. At the $ i $ -th store, he bought an item worth $ A_i $ yen and paid $ B_i $ yen. Here, $ A_i \leq B_i $ holds. If $ S_i = $ `keep`, he did not receive the change, and if $ S_i = $ `take`, he received the change. Find the amount of money he lost compared to the case where he received the change at every store. To be precise, - let $ X $ yen be Takahashi's final amount of money, and - let $ Y $ yen be Takahashi's final amount of money in the case where he received the change at every store. Find $ Y - X $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ > $ A_1 $ $ B_1 $ $ S_1 $ > $ A_2 $ $ B_2 $ $ S_2 $ > $ \vdots $ > $ A_N $ $ B_N $ $ S_N $

Output Format

Output the amount of money Takahashi lost compared to the case where he received the change at every store.

Explanation/Hint

### Sample Explanation 1 Takahashi's actions are as follows. - At the first store, he bought an item worth $ 1 $ yen, paid $ 2 $ yen, and did not receive the change. - At the second store, he bought an item worth $ 3 $ yen, paid $ 6 $ yen, and received the change. - At the third store, he bought an item worth $ 5 $ yen, paid $ 9 $ yen, and did not receive the change. ### Constraints - $ 1 \leq N \leq 100 $ - $ 1 \leq A_i \leq B_i \leq 100 $ - $ S_i $ is `keep` or `take`. - $ N, A_i, B_i $ are all integers.