#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double eps = (1e-4);
int dcmp(long double x, long double y) {
  if (abs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
const int MAX_N = 300010;
const int MOD = 1000000009;
long long add(long long x, long long y) {
  x += y;
  if (x >= MOD) x -= MOD;
  if (x < 0) x += MOD;
  return x;
}
long long a[MAX_N], fib[MAX_N], preSum[MAX_N], fibPre[MAX_N];
pair<int, int> buffer[MAX_N];
long long lazy[MAX_N];
int bs;
long long getSum(long long p[], int l, int r) {
  if (!l) return p[r];
  return add(p[r], -p[l - 1]);
}
void applyQuery(int l, int r) {
  int fibL = 0, fibR = r - l;
  lazy[l] = add(lazy[l], 1);
  lazy[r + 1] = add(lazy[r + 1], -fib[fibR + 1]);
  lazy[r + 2] = add(lazy[r + 2], -fib[fibR]);
}
pair<int, int> getIntersection(int l1, int r1, int l2, int r2) {
  pair<int, int> ret;
  ret = {max(l1, l2), min(r1, r2)};
  if (ret.first > ret.second) return {-1, -1};
  return ret;
}
void createPre(long long x[], long long pre[], int size) {
  pre[0] = x[0];
  for (int i = 1; i < size; ++i) pre[i] = add(pre[i - 1], x[i]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  fib[0] = fib[1] = 1;
  for (int i = 2; i < n + 3; ++i) fib[i] = add(fib[i - 1], fib[i - 2]);
  createPre(fib, fibPre, n + 3);
  for (int i = 0; i < n; ++i) cin >> a[i];
  createPre(a, preSum, n);
  const int S = 500;
  while (q--) {
    if (bs >= S) {
      for (int i = 0; i < n; ++i) {
        if (i > 0) lazy[i] = add(lazy[i], lazy[i - 1]);
        if (i > 1) lazy[i] = add(lazy[i], lazy[i - 2]);
        a[i] = add(a[i], lazy[i]);
      }
      bs = 0;
      memset(lazy, 0, sizeof(lazy));
      createPre(a, preSum, n);
    }
    int qt, l, r;
    cin >> qt >> l >> r;
    --l;
    --r;
    if (qt == 1) {
      buffer[bs++] = {l, r};
      applyQuery(l, r);
    } else {
      long long ans = getSum(preSum, l, r);
      for (int i = 0; i < bs; ++i) {
        int a = buffer[i].first, b = buffer[i].second;
        pair<int, int> inter = getIntersection(l, r, a, b);
        if (inter.first != -1 && inter.second - a >= 0)
          ans = add(ans,
                    getSum(fibPre, max(0, inter.first - a), inter.second - a));
      }
      cout << ans << '\n';
    }
  }
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

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 = 3.14159265358979323846;
const double eps = (1e-4);
int dcmp(long double x, long double y) {
  if (abs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
const int MAX_N = 300010;
const int MOD = 1000000009;
long long add(long long x, long long y) {
  x += y;
  if (x >= MOD) x -= MOD;
  if (x < 0) x += MOD;
  return x;
}
long long a[MAX_N], fib[MAX_N], preSum[MAX_N], fibPre[MAX_N];
pair<int, int> buffer[MAX_N];
long long lazy[MAX_N];
int bs;
long long getSum(long long p[], int l, int r) {
  if (!l) return p[r];
  return add(p[r], -p[l - 1]);
}
void applyQuery(int l, int r) {
  int fibL = 0, fibR = r - l;
  lazy[l] = add(lazy[l], 1);
  lazy[r + 1] = add(lazy[r + 1], -fib[fibR + 1]);
  lazy[r + 2] = add(lazy[r + 2], -fib[fibR]);
}
pair<int, int> getIntersection(int l1, int r1, int l2, int r2) {
  pair<int, int> ret;
  ret = {max(l1, l2), min(r1, r2)};
  if (ret.first > ret.second) return {-1, -1};
  return ret;
}
void createPre(long long x[], long long pre[], int size) {
  pre[0] = x[0];
  for (int i = 1; i < size; ++i) pre[i] = add(pre[i - 1], x[i]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  fib[0] = fib[1] = 1;
  for (int i = 2; i < n + 3; ++i) fib[i] = add(fib[i - 1], fib[i - 2]);
  createPre(fib, fibPre, n + 3);
  for (int i = 0; i < n; ++i) cin >> a[i];
  createPre(a, preSum, n);
  const int S = 500;
  while (q--) {
    if (bs >= S) {
      for (int i = 0; i < n; ++i) {
        if (i > 0) lazy[i] = add(lazy[i], lazy[i - 1]);
        if (i > 1) lazy[i] = add(lazy[i], lazy[i - 2]);
        a[i] = add(a[i], lazy[i]);
      }
      bs = 0;
      memset(lazy, 0, sizeof(lazy));
      createPre(a, preSum, n);
    }
    int qt, l, r;
    cin >> qt >> l >> r;
    --l;
    --r;
    if (qt == 1) {
      buffer[bs++] = {l, r};
      applyQuery(l, r);
    } else {
      long long ans = getSum(preSum, l, r);
      for (int i = 0; i < bs; ++i) {
        int a = buffer[i].first, b = buffer[i].second;
        pair<int, int> inter = getIntersection(l, r, a, b);
        if (inter.first != -1 && inter.second - a >= 0)
          ans = add(ans,
                    getSum(fibPre, max(0, inter.first - a), inter.second - a));
      }
      cout << ans << '\n';
    }
  }
  return 0;
}

```