#include <bits/stdc++.h>
using namespace std;
const double PI = 4 * atan(1);
int N, M;
int A[300013];
int pre[300013];
int dfib[300013];
vector<pair<int, int> > updates;
int f[300013], fp[300013];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> A[i];
  f[1] = 1;
  for (int i = 2; i <= N + 2; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % 1000000009;
    fp[i] = (fp[i - 1] + f[i - 1]) % 1000000009;
  }
  for (int q = 0; q < M; q++) {
    if (q % 500 == 0) {
      for (int i = 1; i < N; i++) {
        dfib[i] = (dfib[i] + dfib[i - 1]) % 1000000009;
        if (i >= 2) dfib[i] = (dfib[i] + dfib[i - 2]) % 1000000009;
      }
      for (int i = 0; i < N; i++) {
        A[i] = (A[i] + dfib[i]) % 1000000009;
        pre[i + 1] = (pre[i] + A[i]) % 1000000009;
      }
      memset(dfib, 0, sizeof dfib);
      updates.clear();
    }
    int t, l, r;
    cin >> t >> l >> r;
    --l;
    if (t == 1) {
      updates.emplace_back(l, r);
      dfib[l]++;
      dfib[r] = (dfib[r] + 1000000009 - f[r - l + 1]) % 1000000009;
      dfib[r + 1] = (dfib[r + 1] + 1000000009 - f[r - l]) % 1000000009;
    } else {
      int ans = (pre[r] - pre[l] + 1000000009) % 1000000009;
      for (const auto& p : updates) {
        if (p.first < r && p.second > l) {
          int lo = 1 + max(0, l - p.first);
          int hi = 1 + min(p.second, r) - p.first;
          ans =
              (ans + (fp[hi] - fp[lo] + 1000000009) % 1000000009) % 1000000009;
        }
      }
      cout << ans << '\n';
    }
  }
  cout.flush();
  return 0;
}

### Prompt

Please create a solution in Cpp to the following problem:

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation 

F1 = 1; F2 = 1; Fn = Fn - 1 + Fn - 2 (n > 2).

DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1, a2, ..., an. Moreover, there are m queries, each query has one of the two types:

  1. Format of the query "1 l r". In reply to the query, you need to add Fi - l + 1 to each element ai, where l ≤ i ≤ r. 
  2. Format of the query "2 l r". In reply to the query you should output the value of <image> modulo 1000000009 (109 + 9). 



Help DZY reply to all the queries.

Input

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 300000). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — initial array a.

Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1 ≤ l ≤ r ≤ n holds.

Output

For each query of the second type, print the value of the sum on a single line.

Examples

Input

4 4
1 2 3 4
1 1 4
2 1 4
1 2 4
2 1 3


Output

17
12

Note

After the first query, a = [2, 3, 5, 7].

For the second query, sum = 2 + 3 + 5 + 7 = 17.

After the third query, a = [2, 4, 6, 9].

For the fourth query, sum = 2 + 4 + 6 = 12.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const double PI = 4 * atan(1);
int N, M;
int A[300013];
int pre[300013];
int dfib[300013];
vector<pair<int, int> > updates;
int f[300013], fp[300013];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> A[i];
  f[1] = 1;
  for (int i = 2; i <= N + 2; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % 1000000009;
    fp[i] = (fp[i - 1] + f[i - 1]) % 1000000009;
  }
  for (int q = 0; q < M; q++) {
    if (q % 500 == 0) {
      for (int i = 1; i < N; i++) {
        dfib[i] = (dfib[i] + dfib[i - 1]) % 1000000009;
        if (i >= 2) dfib[i] = (dfib[i] + dfib[i - 2]) % 1000000009;
      }
      for (int i = 0; i < N; i++) {
        A[i] = (A[i] + dfib[i]) % 1000000009;
        pre[i + 1] = (pre[i] + A[i]) % 1000000009;
      }
      memset(dfib, 0, sizeof dfib);
      updates.clear();
    }
    int t, l, r;
    cin >> t >> l >> r;
    --l;
    if (t == 1) {
      updates.emplace_back(l, r);
      dfib[l]++;
      dfib[r] = (dfib[r] + 1000000009 - f[r - l + 1]) % 1000000009;
      dfib[r + 1] = (dfib[r + 1] + 1000000009 - f[r - l]) % 1000000009;
    } else {
      int ans = (pre[r] - pre[l] + 1000000009) % 1000000009;
      for (const auto& p : updates) {
        if (p.first < r && p.second > l) {
          int lo = 1 + max(0, l - p.first);
          int hi = 1 + min(p.second, r) - p.first;
          ans =
              (ans + (fp[hi] - fp[lo] + 1000000009) % 1000000009) % 1000000009;
        }
      }
      cout << ans << '\n';
    }
  }
  cout.flush();
  return 0;
}

```