Marc Coin

Bill and Ethan are trading a cryptocurrency called Marc Coin on the Blocchain, a digital ledger for keeping track of Marc Coin transactions between its traders.

Bill and Ethan make a number of transactions TT between each other. Each transaction consists of three things: a transaction ID, a Marc Coin value, and the sender (either Bill or Ethan).

If the sender is Bill, then the receiver is Ethan, and vice versa.

Bill and Ethan both begin with a set balance of 100 Marc Coin.

After all transactions have been made, Bill and Ethan may decide to 'reverse' a number RR of their previous transactions. For example, if Bill gave Ethan 23 Marc Coin in transation "845", and later they decide to reverse this transaction, then Ethan gives back Bill 23 Marc Coin.

Input Format

The first line contains non-negative integers TT and RR which are the number of transactions and reversals, respectively.

The next TT lines each describe a transaction, including: - a unique and random 3-digit integer transaction ID such as 845, - a non-negative integer Marc Coin value such as 23, and - a single character denoting the sender, either B for Bill or E for Ethan.

The next RR lines each describe a reversal using a transaction ID.

Constraints

For all test cases:

  • 0<RT<10000 < R \le T < 1000
  • All given transaction IDs will be unique.
  • All given reversals will only be made on existing transactions and no more than once.
  • Bill and Ethan can go into debt with each other, but their balances by the end of the transactions and reversals should always add to 200.

Output Format

Output a single line with two integers separated by a space: Bill and Ethan's final balances, respectively.

Sample Input 0

2 1
438 15 B
892 30 E
438

Sample Output 0

130 70

Sample Test Case 0 Explanation

We are given 2 transactions and one reversal. The transactions have id 438 and 892. The reversal has id 438.

After applying a reversal, our list of transactions could look like the following:

438 15 B 
438 15 E
892 30 E

Now we can see Bill sends 15 and receives 45, giving him a net gain of 30. Ethan sends 45 and receives 15, giving him a net loss of 30. Thus the final balances are 130 70.

Sample Input 1

5 3
648 18 B
232 64 E
792 12 E
738 18 B
943 6 E
232
738
648

Sample Output 1

118 82

Sample Test Case 1 Explanation

We are given 5 transactions and 3 reversals. After applying the reversals our list of transactions could look like the following:

648 18 B
648 18 E
232 64 E
232 64 B
792 12 E
738 18 B
738 18 E
943 6 E

We can see that Bill sent 100 (18 + 64 + 18) and Ethan sent 118 (18 + 64 + 12 + 18 + 6). The net gain for Bill is 18 and the net loss for Ethan is 18.

Hence the final balances are 118 82.