#1425. Easy problem II

Easy problem II

For a given sequence of nn intergers aia_i.

There are two types of operations:

1lrx(1lrn)1 \quad l \quad r \quad x \qquad (1 ≤ l ≤ r ≤ n) — for each i[l,r]i \in [l, r], if ai<xa_i < x, change ai=xaia_i = x - a_i, else change ai=x+aia_i = x + a_i.

2lr(1lrn)2 \quad l \quad r \qquad (1 ≤ l ≤ r ≤ n) — output ans = i=lrai\sum_{i=l}^{r} a_i.

Input

The input consists of multiple test cases. The first line contains a single integer TT(1T51 ≤ T ≤ 5) — the number of test cases.

The first line of each test case contains two integers nn and mm, (1n1051 ≤ n ≤ 10^5, 1m1051 ≤ m ≤ 10^5) — the length of sequence and the number of operations.

The next line contains nn integer aia_i (0ai1070 ≤ a_i ≤ 10^7)

The next mm line contains some integers optopt, ll, rr, xx (1opt21 ≤ opt ≤ 2, 1lrn1 ≤ l ≤ r ≤ n, 0x1070 ≤ x ≤ 10^7) — indicating the operations.

Output

For each query, output an interger in a single line indicating the ans.

Example

1
5 5
1 2 3 4 5
1 1 5 3
2 1 2
2 2 4
1 2 3 5
2 1 5
3
14
32

Limitation

Time limit: 8 second

Memory limit: 512 megabytes