Range product queries

Answer range product queries modulo 1,000,000,007 on a sequence with point updates.

Medium4Segment treeInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

You are given a sequence of NN numbers. Elements of the sequence change often, and between those changes you have to compute the product of some range.

For example, take the sequence 1, 2, 3, 4, 5. Change the third number to 6 and ask for the product from the second number to the fifth, and the answer is 240. Then change the fifth number to 2 and ask for the product from the third number to the fifth, and the answer is 48.

Given changes and range product queries mixed together, write a program that computes the product for each query.

Input

The first line contains the count of numbers NN (1N1,000,0001 \le N \le 1{,}000{,}000), the number of changes MM (1M10,0001 \le M \le 10{,}000), and the number of range product queries KK (1K10,0001 \le K \le 10{,}000), separated by spaces.

The next NN lines contain the elements of the sequence in order, one per line.

The following M+KM + K lines each contain three integers aa, bb, and cc. If aa is 1, change the bb-th number to cc. If aa is 2, compute the product from the bb-th number to the cc-th number. On a line where aa is 2, bcb \le c holds.

Every number in the input is an integer between 0 and 1,000,000, inclusive.

Output

Print one line for each product query, in the order the queries are given, for a total of KK lines. Each line holds the product of that range modulo 1,000,000,007.