Generating the Sequence
시간 제한10초메모리 제한2048 MB
홀수로 이루어진 수열에 짝수 범위 덧셈을 하고, 구간 곱을 2^20으로 나눈 나머지를 구한다.
문제
There is a sequence of length , and it is guaranteed that each is an odd number.
There are two types of operations:
- Given , , and , add an even number to each of the elements .
- Given and , find the product of , and output the answer modulo .
Given the initial sequence and the operations, perform them efficiently.
입력
The first line of the input contains two positive integers and () representing the length of the sequence and the number of queries.
The second line contains odd numbers ().
The following lines represent queries, each in one of the following two formats:
- "
1": perform the first type of operation (, the value is even and ). - "
2": perform the second type of operation ().
All the values in the queries are integers.
출력
For each query of type 2, output one line with an integer representing the answer.