Array Counting

Time limit: 0.5s Memory limit: 64MB Input: Output:

Given an array of length nn and a number kk, we need to process qq queries of the following types:

1 a b1 \ a \ b: Change the value of the number at position aa to bb

2 l r s2 \ l \ r \ s: Find how many arrays exist which can be formed with the numbers from positions ll to rr, such that the value of each of the numbers is at least kk and the sum of the values is equal to ss, if the only operation we can make is to increase values of the numbers from the array. Since the number of arrays can be really big, print the answer mod 109+710^9 + 7

Input

The first line will contain three integers, nn, qq and kk, which represent the length of the array, the number of queries we need to process and the minimal threshold for the value of each number with respect to the second type of query.

The second line of the input will contain the initial array vv.

The next qq lines of the input will contain the description of the queries.

Output

The output will contain a line for each query of type 22, with the answer for each query of type 22.

Constraints

  • 1n51041 \leq n \leq 5 \cdot 10^4
  • 1q21051 \leq q \leq 2\cdot 10^5
  • 1k201 \leq k \leq 20
  • 1v[i],b1001 \leq v[i], b \leq 100
  • 1a,l,rn1 \leq a, l, r \leq n
  • 1s21061 \leq s \leq 2 \cdot 10^6
  • For tests worth 2020 points, 1n201 \leq n \leq 20
  • For tests worth 4040 additional points, 1n2 0001 \leq n \leq 2 \ 000, 1q5 0001 \leq q \leq 5 \ 000

Example

stdin

4 5 2
0 0 0 3
2 1 4 10
1 1 2
2 2 3 3
1 2 4
2 1 2 6

stdout

4
0
1

Explanation

For the first query, the arrays we can get are [22, 22, 33, 33], [22, 33, 22, 33], [33, 22, 22, 33], [22, 22, 22, 44].

Log in or sign up to be able to send submissions!