Queries on anti-xor#7247

Queries on anti-xor

2.5 seconds
64 megabytes
Very easy

Recently our coach - Etibar has invented a new bitwise operation. It is like a reverse of xor operation. He then called it anti-xor. Now he is giving you a new problem which is related to his invention on queries. The sign of anti-xor is #.

You are given numbers. Perform the following operations on those integers.

1) Anti-xor with integer from to . This query is represented as "1 L R X"

2) Output the sum of all numbers from to . This query is represented as "2 L R"

Assume that all numbers are bits integers. So you do anti-xor operation on last bits.

Input

You are given an integer (1 \le N \le 100000). In the second line you are given integers (0 \le A_i \le 10^6). The next line contains the number of queries (1 \le Q \le 100000). Each of the next lines contains one query of one of the forms above.

Output

For each query of the type "2 L R" print on a separate line the sum of all integers from to .

Examples

Example 1

Loading
Loading