You are to hold a cookie party! You have prepared N cookies numbered from 1 through N. The sweetness of the cookie i is A_i. You expect that M children numbered from 1 to M will attend the party. All of them will bring their homemade cookies, and the child i will bring a cookie of sweetness B_i. Besides, you know the taste preference of each child. The child i loves sweet cookies if S_i=S and loves bitter cookies if S_i=B.
The party will proceed in the following manner:
You have not yet decided the value of k. For each integer k=1,2,⋯,N, find the sum of the sweetness of cookies you will eat.
Note that only after you get the answer for k=i can you know the value of A_i+1. See the input section for more details.
Input is given from Standard Input in the following format:
N
A′_1 A′_2 ⋯ A′_N
M
B_1 B_2 ⋯ B_M
S
Here A′_i is the encrypted value of A_i, and the real value can be calculated as A_i=(A′_i+lastansmod109), where lastans denotes the answer for k=i−1 if i>1 and 0 if i=1.
Print N integers in one line. The i-th integer should be the sum of the sweetness of cookies you will eat when k=i.
S' or 'B'.In first sample, A=(3,1,5).
When k=2, the party proceeds as follows: