You are given a sequence consisting of NN integers {ai}. There will be mm different events.
Please write a program to support these events efficiently.
The first line contains two integers N,M (1≤N,M≤400000) denoting the length of sequence and the number of events.
The second line contains NN integers a1,a2,⋯,an (1≤ai≤230−1) denoting the initial elements of the sequence.
For the next M lines, each line describes an event. It is guaranteed that 1≤l,r,x≤nand 1≤v≤230−1.
For each QUEQUE event, print a single line containing an integer, denoting the answer.
It is guaranteed that there is at least one QUEQUE event.
5 11 6 3 5 2 3 AND 2 4 10 UPD 1 8 AND 3 4 7 UPD 1 6 QUE 1 4 AND 3 5 10 AND 3 5 2 UPD 5 1 QUE 2 5 UPD 3 6 QUE 1 5
6 2 6
5 11
6 3 5 2 3
AND 2 4 10
UPD 1 8
AND 3 4 7
UPD 1 6
QUE 1 4
AND 3 5 10
AND 3 5 2
UPD 5 1
QUE 2 5
UPD 3 6
QUE 1 5
6
2
6