The court wizard Zigzag wants to become a famous mathematician. For that, he needs his own theorem, like the Cauchy theorem, or his sum, like the Minkowski sum. But most of all he wants to have his sequence, like the Fibonacci sequence, and his function, like the Euler's totient function.

The Zigag's sequence with the zigzag factor z is an infinite sequence *S*<sub class="lower-index">*i*</sub><sup class="upper-index">*z*</sup> (*i* ≥ 1; *z* ≥ 2), that is determined as follows:
 -  *S*<sub class="lower-index">*i*</sub><sup class="upper-index">*z*</sup> = 2, when <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/51bbc88da75b54dcdcb2c2613259cdb7dabe1294.png" style="max-width: 100.0%;max-height: 100.0%;"/>; -  <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/3fc20322d0b5ffae1c3d0284a12bf23e11eaf17a.png" style="max-width: 100.0%;max-height: 100.0%;"/>, when <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/461f79f84094b56b6e5513c1f92583def26c2f82.png" style="max-width: 100.0%;max-height: 100.0%;"/>; -  <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/4dc72e713993d7ff03be2790751dfc0516c1e2b9.png" style="max-width: 100.0%;max-height: 100.0%;"/>, when <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/bb9c23fd7526e8b8019832016ef7e229963b5f2b.png" style="max-width: 100.0%;max-height: 100.0%;"/>. 
Operation <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/f58f159973d4609d919286c1821e69cd34d81118.png" style="max-width: 100.0%;max-height: 100.0%;"/> means taking the remainder from dividing number *x* by number *y*. For example, the beginning of sequence *S*<sub class="lower-index">*i*</sub><sup class="upper-index">3</sup> (zigzag factor 3) looks as follows: 1, 2, 3, 2, 1, 2, 3, 2, 1.

Let's assume that we are given an array *a*, consisting of *n* integers. Let's define element number *i* (1 ≤ *i* ≤ *n*) of the array as *a*<sub class="lower-index">*i*</sub>. The Zigzag function is function <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/9d7bd279425165bd11f674f425aeec826f592718.png" style="max-width: 100.0%;max-height: 100.0%;"/>, where *l*, *r*, *z* satisfy the inequalities 1 ≤ *l* ≤ *r* ≤ *n*, *z* ≥ 2.

To become better acquainted with the Zigzag sequence and the Zigzag function, the wizard offers you to implement the following operations on the given array *a*.
 1.  The assignment operation. The operation parameters are (*p*, *v*). The operation denotes assigning value *v* to the *p*-th array element. After the operation is applied, the value of the array element *a*<sub class="lower-index">*p*</sub> equals *v*. 1.  The Zigzag operation. The operation parameters are (*l*, *r*, *z*). The operation denotes calculating the Zigzag function *Z*(*l*, *r*, *z*). 
Explore the magical powers of zigzags, implement the described operations.
The first line contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>) — The number of elements in array *a*. The second line contains *n* space-separated integers: *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the elements of the array. 

The third line contains integer *m* (1 ≤ *m* ≤ 10<sup class="upper-index">5</sup>) — the number of operations. Next *m* lines contain the operations' descriptions. An operation's description starts with integer *t*<sub class="lower-index">*i*</sub> (1 ≤ *t*<sub class="lower-index">*i*</sub> ≤ 2) — the operation type. 
 -  If *t*<sub class="lower-index">*i*</sub> = 1 (assignment operation), then on the line follow two space-separated integers: *p*<sub class="lower-index">*i*</sub>, *v*<sub class="lower-index">*i*</sub> (1 ≤ *p*<sub class="lower-index">*i*</sub> ≤ *n*; 1 ≤ *v*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the parameters of the assigning operation. -  If *t*<sub class="lower-index">*i*</sub> = 2 (Zigzag operation), then on the line follow three space-separated integers: *l*<sub class="lower-index">*i*</sub>, *r*<sub class="lower-index">*i*</sub>, *z*<sub class="lower-index">*i*</sub> (1 ≤ *l*<sub class="lower-index">*i*</sub> ≤ *r*<sub class="lower-index">*i*</sub> ≤ *n*; 2 ≤ *z*<sub class="lower-index">*i*</sub> ≤ 6) — the parameters of the Zigzag operation. 
You should execute the operations in the order, in which they are given in the input.
print("_RANDOM_GUESS_1691442658.7122102")# 1691442658.7122512