Under construction

Still being built. Things may change

Learning is light, not learning is darkness

Time limit4sMemory limit1024 MB

Summary
Given an array with point updates, answer range queries for the number of divisors of the segment's product, modulo 1000000007.
Level

Medium6 of 10

Topics
Array, Number theory, Segment tree, Math
Solved
No attempts yet

Problem

Lately Alf has done nothing at all. He has not even broken anything in the past week. Linn decided it was time he stopped idling and started studying.

Linn chose a simple problem to start with. You are given an array of positive integers. Two kinds of operations are performed on the array:

  • 0 i x: assign the value xx to the ii-th element of the array.
  • 1 l r: output the number of divisors of the product of the numbers on the segment from ll to rr. This number can be very large, so output the answer modulo 109+710^9+7.

Alf is secretly in love with Linn, so he cannot refuse her. He does not want to do the work, though. So he asked you to write a program that solves this problem without Linn finding out.

Input

The first line contains the number nn (1≤n≤5⋅1041 \le n \le 5 \cdot 10^4), the number of elements in the array.

The second line contains nn integers aia_i (1≤ai≤1041 \le a_i \le 10^4), the elements of the array.

The third line contains the number qq (1≤q≤1041 \le q \le 10^4), the number of queries.

Each of the next qq lines contains three integers. If the first integer is 0, the query updates an array element. If the first integer is 1, the query asks for the number of divisors of the product on a segment.

It is guaranteed that in every query 1≤i,l,r≤n1 \le i, l, r \le n and 1≤x≤1041 \le x \le 10^4.

Output

For each query of type 1, output on its own line the number of divisors of the product of all numbers on the given segment, modulo 109+710^9+7.

Examples1

  1. Example 1

    Input
    5
    2 3 4 5 6
    6
    1 2 4
    1 2 3
    0 1 1
    0 4 7
    1 1 3
    1 1 4
    
    Expected output
    12
    6
    6
    12