시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.7 초 1024 MB1000.000%

문제

Due to unforeseen circumstances this task is not fifth.

A recent survey by polling agency "Ko & co" found that no one likes the numbers from $1$ to $4$. So we will focus on the next number, $5$, and hope it does not follow the unfortunate fate of its predecessors.

Consider the following sequence in the positive and negative indices:

  • $x_0 = 0$
  • $x_1 = 1$
  • $x_2 = 2$
  • $x_3 = 3$
  • $x_4 = 4$
  • $x_{k+5} = 5 \times x_{k+4} + 4 \times x_{k+3} + 3 \times x_{k+2} + 2 \times x_{k+1} + 1 \times x_k$ for each integer $k$.

Note that equality uniquely defines both the positive and the negative indices (e.g. $x_5 = 40$, $x_6 = 230$, $\dots$ and $x_{-1} = -22$, $x_{-2} = 33$, $\dots$)

You are given an array of $n$ numbers $a_1, a_2 , \dots, a_n$. Write a program five that supports $2$ types of events:

  • Query with parameters $l$, $r$. We want to find the value $x_{a_l} + x_{a_{l+1}} + \dots + x_{a_r} = \sum_{i=l}^r{x_{a_i}}$. Since it can get very large, print the answer modulo $M = 10^8 + 543$.
  • Update with parameters $l$, $r$, $value$ Then the new value of $a_i$ becomes equal to $a_i + value$ for every $l ≤ i ≤ r$.

입력

The first line of the standard input contains the numbers $n$ and $q$. The next line contains $n$ integers $a_1, a_2 ,\dots , a_n$. Each of the following $q$ lines contains $3$ natural numbers $type$, $l$, $r$.

  • If $type = 1$, then the line is a Query.
  • If $type = 2$, then the line is an Update and contains a further integer $value$.

출력

For each Query, print on a new line the answer for that query.

제한

  • $1 ≤ n ≤ 100\,000$
  • $1 ≤ q ≤ 200\,000$
  • $1 ≤ l ≤ r ≤ n$
  • $-M < a_i , value < M$

서브태스크

번호배점제한
15

$0 ≤ a_i ≤ 10^6$ and only Query

219

$0 ≤ a_i, value$ and $l = r$

319

$0 ≤ a_i, value$ and $q ≤ 20\,000$

419

$q ≤ 20\,000$

519

$q ≤ 100\,000$

619

None

예제 입력 1

1 5
1
1 1 1
2 1 1 -2
1 1 1
2 1 1 8
1 1 1

예제 출력 1

1
100000521
1330

At the start $a_1 = 1$ and $x_{a_1} = 1$. After the first Update $a_1 = -1$ and $x_{a_1} = -22$. After the second Update $a_1 = 7$ and $x_{a_1} = 1330$.

채점 및 기타 정보

  • 예제는 채점하지 않는다.