Consider a line-up of 10 people who have different numbers of coins. For example, the numbers of coins they have could be
6 5 8 7 4 10 20 30 40 50
Given a sequence of operations of passing coins forward and backward, carry out all of the operations and print the result. The operations are presented in a format as follows:
4 F 6
4 B 1
5 F 100
5 F 10
7 B 10
1 B 5
where 'F' stands for forward and 'B' stands for backward. The first operation "4 F 6" means that the fourth person gives 6 coins to the next person. Therefore, after this operation, the fourth person has only 1 (=7-6) coin and the fifth person has 10 (=4+6) coins. The second operation "4 B 1" means that the fourth person gives 1 coin to the previous person, and therefore the third person will have 9 (=8+1) coins and the fourth person will have 0 (=1-1) coin. The third operation cannot be done because the fifth person does not have 100 coins to give; In this case, the operation will be ignored and no change is made. The subsequent operations can be carried out based on the same rules.
Note that, for the tenth person, a forward pass means giving coins to the first person, and likewise, for the first person, a backward pass means giving coins to the tenth person, such as the last operation "1 B 5" in the above example. Finally, the result should look like
1 5 9 0 0 30 10 30 40 55
The first line contains ten positive integers indicating the initial numbers of coins owned by the ten people.
The second line contains an integer N (1<=N<=100) denoting the number of operations.
The next N lines contain the N operations in the form of
Person_Id Forward_Or_Backward Number_Of_Coins
Person_Id is from 1 to 10. Number_Of_Coins is a positive integer.
The output is shown in ten lines, each of which contains the number of coins owned by the person after the operations. Be sure to add a newline character '\n' at the end of each line.