Yes, it happened! The first contact! Aliens will visit the Earth in ! And they promised to bring an enigmatic device which cannot be constructed using existing Earth technologies. Most of the scientists of the world think so! All newspapers already published their leading articles about it.
This device will accept an integer sequence \{a_i\} as its initial input. After that, it can perform the following two operations:
Take an interval [l; r] and perform a_i \leftarrow a_i^2 \bmod 2010 for all a_i such that l \leq i \leq r.
Take an interval [l; r] and output the sum of all a_i such that l \leq i \leq r. Note that the sum is not taken modulo .
The amazing thing about this device is that it is able to perform operations of this kind with a sequence of numbers within seconds. Nobody could do it before!
But Roman does not believe in aliens and thinks that it is only a great hoax made by somebody just to win another million bucks on the stock exchange. His goal is to prove this. So he hired you to write a program to simulate this device.
Given an integer sequence a_i and a sequence of operations, write a program which simulates the behaviour of the strange alien device.
The first line of the input contains the length of the sequence (1 \leq n \leq 50000). The second line contains numbers a_i forming the initial sequence (0 \leq a_i \leq 2009). The third line contains the number of operations (1 \leq m \leq 50000). The rest of file contains lines, each describing one operation. The -th operation is described by its kind k_j ('1' for squaring, '2' for calculating the sum), followed by two integers l_j and r_j (1 \leq l_j \leq r_j \leq n).
For each operation of the second kind, write their output on the separate line, in order they appear in the input.
Example 1