E. 简单的数据结构题
time limit per test
5 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

你需要维护一个非负整数序列 $$$[a_1, a_2, a_3, \cdots, a_n]$$$($$$0 \leq a_i \lt 16$$$),支持以下三种操作:

  • $$$1$$$ $$$l$$$ $$$r$$$:将子区间 $$$[a_l, a_{l+1}, a_{l+2}, \cdots, a_r]$$$ 内的每个 $$$a_i$$$ 变为 $$$\left ( a_i + 1 - 16 \cdot \left \lfloor \frac{a_i + 1}{16} \right \rfloor \right )$$$。
  • $$$2$$$ $$$l$$$ $$$r$$$:将子区间 $$$[a_l, a_{l+1}, a_{l+2}, \cdots, a_r]$$$ 内的每个 $$$a_i$$$ 变为 $$$ \left ( 2 \cdot a_i - 15 \cdot \left \lfloor \frac{a_i}{8} \right \rfloor \right )$$$。
  • $$$3$$$ $$$l$$$ $$$r$$$:我们令 $$$cnt_x$$$ 表示子区间 $$$[a_l, a_{l+1}, a_{l+2}, \cdots, a_r]$$$ 内数字 $$$x$$$ 出现的次数。计算并输出 $$$\bigoplus_{i=0}^{15} cnt_i$$$,即 $$$cnt_0, cnt_1, \cdots, cnt_{15}$$$ 按位异或的结果。

可以证明,在以上三种操作下,任何时刻,序列中的元素 $$$a_i$$$ 都满足 $$$0 \leq a_i \lt 16$$$。

Input

第一行包含两个整数 $$$n$$$ 和 $$$q$$$($$$1 \leq n,q \leq 5 \cdot 10^5$$$),分别表示序列长度与操作次数。

第二行包含 $$$n$$$ 个整数 $$$a_1, a_2, a_3, \cdots, a_n$$$($$$0 \leq a_i \lt 16$$$),表示序列的初始值。

接下来的 $$$q$$$ 行,第 $$$i$$$ 行包含 $$$ty_i$$$、$$$l_i$$$、$$$r_i$$$ 三个整数($$$1 \leq ty_i \leq 3$$$ 且 $$$1 \leq l_i \leq r_i \leq n$$$),表示第 $$$i$$$ 次操作的类型,与操作涉及的区间。

Output

对于每个类型为 $$$3$$$ 的操作,输出一行,包含一个整数,表示答案。

Example
Input
6 10
1 1 4 5 1 4
1 1 6
1 4 5
2 2 4
3 1 1
2 2 3
1 4 4
3 2 5
3 1 5
1 1 4
3 1 6
Output
1
0
1
2