The city council of the capitol city is interested in increasing the size of the buildings along their main street to attract more businesses, but they are worried that if they build too fast, they may run out of money, so they want to build their city in multiple phases. Assume that the street is n units long and the buildings are one unit wide. In each phase, the council will choose two endpoints (1 ≤ a ≤ b ≤ 100,000) and increase the height of every building in between a and b (inclusively) by y units. For example, here is the sky-line of a city before andafterthechange: a=2,b=10,y=1(Thenumbers below the road are for your sanity). X X ----> XXX X X XXXX _X__XXXXXX_XX 123456789012345678 X XXXXXX XXXXXXXXXXXX_XX 123456789012345678 Keeping track of the heights of the buildings can be rather tricky over time, so we need your help. Input Input file contains at most 8 (eight) test cases. Each test case starts with a positive integer T on the first line, the number of instructions. Each of the following T (T ≤ 100, 000) lines will be in one of the following two formats: • ‘B a b y’ : Building instruction — Increase the height of the buildings between a and b by y units. • ‘Q a’: Query line — Output the height of building a at this point. Input lines are always valid, i.e., 1 ≤ a ≤ b ≤ 100, 000. The value of y is a positive integer, at most 1,000. You can assume that the main street is completely flat before the first phase, i.e., height is zero for every building i in [1, 100000]. Input is terminated by a case where the value of T is zero. Output For each query line of each test case, output the height of the specified building on a separate line. Sample Input 9 B552 B882 B 10 13 1 Q8
2/2 B 8 13 1 Q8 B 15 16 1 B 2 10 1 Q8 9 B552 B882 B 10 13 1 Q8 B 8 13 1 Q8 B 15 16 1 B 2 10 1 Q8 0 Sample Output 2 3 4 2 3 4