P7134 Little H’s Sequence.
Background
Little H has a sequence.
Description
**$O2$ optimization is automatically enabled when submitting.**
Little H wants you to maintain a sequence $a_1,a_2,\ldots,a_n$ of length $n$, and support:
- Update operation: change the value of all $a_i$ that satisfy $i\in[l,r]$ and $u\le a_i\le v$ to $w$.
- Query operation: compute $\sum_{i=l}^r a_i^t \bmod k$.
Input Format
There are $m+2$ lines in total.
The first line contains two positive integers $n,m$, representing the length of the sequence and the number of operations.
The second line contains $n$ positive integers $a_1,a_2\ldots,a_n$, representing the initial sequence.
The next $m$ lines each start with a number $o$, representing the operation type.
- If $o=0$, it means an update operation, followed by five positive integers $l,r,u,v,w$.
- If $o=1$, it means a query operation, followed by four positive integers $l,r,t,k$, with the meanings as described in the **Description**.
Numbers in each line are separated by a single space. The testdata is generated under Windows. **There may be extra spaces at the end of lines.**
Output Format
Output one integer per line, representing the XOR of the answers of all query operations (if there is no query operation, output $0$).
Explanation/Hint
All numbers in the input are positive integers.
Assume there is a Constraints value $\mathrm{randmax}$ such that $n,m,a_i,w\le\mathrm{randmax}$, $1\le l\le r\le n$, $1\le u\le v\le \mathrm{randmax}$, $1\le t,k\le10^9$.

It is guaranteed that, except for $n,m$ and the $t$ in test points $4,5$, the data is random. The meaning of each variable is as described in the **Description**.
Because the input size of this problem is large, and to avoid unnecessary judging time, please pay attention to input optimization. The following template is provided (`c++` language):
```cpp
/* ---- read() & rlong() - begin ---- */
#define gc() (p0==p1&&(p1=(p0=buf)+fread(buf,1,1048576,stdin),p0==p1)?EOF:*p0++)
char buf[1048576],*p0,*p1;
inline int read() {
int r=0; char c=gc(); while (c57) c=gc();
while (c>47&&c