Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

E. More Queries to Array...

time limit per test

5 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou've got an array, consisting of *n* integers: *a*_{1}, *a*_{2}, ..., *a*_{n}. Your task is to quickly run the queries of two types:

- Assign value
*x*to all elements from*l*to*r*inclusive. After such query the values of the elements of array*a*_{l},*a*_{l + 1}, ...,*a*_{r}become equal to*x*. - Calculate and print sum , where
*k*doesn't exceed 5. As the value of the sum can be rather large, you should print it modulo 1000000007 (10^{9}+ 7).

Input

The first line contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 10^{5}), showing, how many numbers are in the array and the number of queries, correspondingly. The second line contains *n* integers: *a*_{1}, *a*_{2}, ..., *a*_{n} (0 ≤ *a*_{i} ≤ 10^{9}) — the initial values of the array elements.

Then *m* queries follow, one per line:

- The assign query has the following format: "", (1 ≤
*l*≤*r*≤*n*; 0 ≤*x*≤ 10^{9}). - The query to calculate the sum has the following format: "", (1 ≤
*l*≤*r*≤*n*; 0 ≤*k*≤ 5).

All numbers in the input are integers.

Output

For each query to calculate the sum print an integer — the required sum modulo 1000000007 (10^{9} + 7).

Examples

Input

4 5

5 10 2 1

? 1 2 1

= 2 2 0

? 2 4 3

= 1 4 1

? 1 4 5

Output

25

43

1300

Input

3 1

1000000000 1000000000 1000000000

? 1 3 0

Output

999999986

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/26/2017 04:54:37 (c4).

Desktop version, switch to mobile version.

User lists

Name |
---|