Generating the Sequence

시간 제한10초메모리 제한2048 MB

요약
홀수로 이루어진 수열에 짝수 범위 덧셈을 하고, 구간 곱을 2^20으로 나눈 나머지를 구한다.
난이도

보통10점 중 7점

유형
세그먼트 트리, 정수론
정답자
아직 제출이 없습니다

문제

There is a sequence a_1,a_2,…,a_na\_1, a\_2, \ldots, a\_n of length nn, and it is guaranteed that each a_ia\_i is an odd number.

There are two types of operations:

  1. Given ℓ\ell, rr, and xx, add an even number xx to each of the elements a_ℓ,a_ℓ+1,…,a_ra\_{\ell}, a\_{\ell + 1}, \ldots, a\_{r}.
  2. Given ℓ\ell and rr, find the product of a_ℓ,a_ℓ+1,…,a_ra\_{\ell}, a\_{\ell + 1}, \ldots, a\_{r}, and output the answer modulo 2202^{20}.

Given the initial sequence and the operations, perform them efficiently.

입력

The first line of the input contains two positive integers nn and qq (1≤n,q≤2⋅1051 \leq n, q \leq 2 \cdot 10^5) representing the length of the sequence and the number of queries.

The second line contains nn odd numbers a_1,a_2,…,a_na\_1, a\_2, \ldots, a\_n (1≤a_i<2201 \leq a\_i < 2^{20}).

The following qq lines represent queries, each in one of the following two formats:

  • "1 ℓ\ell rr xx ": perform the first type of operation (1≤ℓ≤r≤n1 \leq \ell \leq r \leq n, the value xx is even and 0≤x<2200 \leq x < 2^{20}).
  • "2 ℓ\ell rr": perform the second type of operation (1≤ℓ≤r≤n1 \leq \ell \leq r \leq n).

All the values in the queries are integers.

출력

For each query of type 2, output one line with an integer representing the answer.

예제1

  1. 예제 1

    입력
    10 10
    969575 741825 24903 1047319 450475 256145 1045323 479255 810659 768323
    1 5 6 3034
    2 1 10
    2 1 9
    2 1 4
    1 3 6 126904
    2 5 5
    2 9 9
    1 7 7 853094
    1 4 9 1025178
    2 5 8
    
    예상 출력
    1045541
    1012343
    558151
    580413
    810659
    527353