#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 9;
const int maxn = 3e5 + 50;
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
long long sum[maxn];
long long a[maxn];
long long fib[maxn];
struct SegTree {
  struct node {
    long long f1, f2, sum;
  } my[maxn << 4];
  void push_up(int o, int len) {
    my[o].f1 %= mod;
    my[o].f2 %= mod;
    my[o].sum = my[(o << 1)].sum + my[(o << 1 | 1)].sum +
                ((my[o].f1 * fib[len]) % mod + (my[o].f2 * fib[len + 1] % mod) -
                 my[o].f2 + mod) %
                    mod;
    my[o].sum %= mod;
  }
  void push_down(int o, int l, int r) {
    if (!my[o].f1 && !my[o].f2) return;
    int mid = (l + r) / 2;
    my[(o << 1)].f1 += my[o].f1;
    my[(o << 1 | 1)].f1 +=
        (my[o].f1 * fib[mid - l]) % mod + (my[o].f2 * fib[mid - l + 1]) % mod;
    my[(o << 1)].f2 += my[o].f2;
    my[(o << 1 | 1)].f2 += (my[o].f1 * fib[mid - l + 1]) % mod +
                           (my[o].f2 * fib[mid - l + 2]) % mod;
    my[o].f1 = my[o].f2 = 0;
    push_up((o << 1), mid - l + 1);
    push_up((o << 1 | 1), r - mid);
  }
  void ins(int o, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) {
      my[o].f1 += fib[l - ql + 1];
      my[o].f1 %= mod;
      my[o].f2 += fib[l - ql + 2];
      my[o].f2 %= mod;
      push_up(o, r - l + 1);
      return;
    }
    push_down(o, l, r);
    int mid = (l + r) / 2;
    if (ql <= mid) ins((o << 1), l, mid, ql, qr);
    if (qr > mid) ins((o << 1 | 1), mid + 1, r, ql, qr);
    push_up(o, r - l + 1);
  }
  long long query(int o, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) {
      return my[o].sum;
    }
    push_down(o, l, r);
    int mid = (l + r) / 2;
    long long ans = 0;
    if (ql <= mid) ans += query((o << 1), l, mid, ql, qr);
    if (qr > mid) ans += query((o << 1 | 1), mid + 1, r, ql, qr);
    ans %= mod;
    return ans;
  }
} seg;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  int n, m;
  cin >> n >> m;
  fib[1] = fib[2] = 1;
  for (int i = 3; i <= n + 3; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
  for (int i = 1; i <= n; i++) cin >> a[i], sum[i] = (sum[i - 1] + a[i]) % mod;
  while (m--) {
    int op, l, r;
    cin >> op >> l >> r;
    if (op == 1)
      seg.ins(1, 1, n, l, r);
    else
      cout << (seg.query(1, 1, n, l, r) + (sum[r] - sum[l - 1]) % mod + mod) %
                  mod
           << endl;
  }
  return 0;
}

### Prompt

Your challenge is to write a CPP solution 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 long long mod = 1e9 + 9;
const int maxn = 3e5 + 50;
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
long long sum[maxn];
long long a[maxn];
long long fib[maxn];
struct SegTree {
  struct node {
    long long f1, f2, sum;
  } my[maxn << 4];
  void push_up(int o, int len) {
    my[o].f1 %= mod;
    my[o].f2 %= mod;
    my[o].sum = my[(o << 1)].sum + my[(o << 1 | 1)].sum +
                ((my[o].f1 * fib[len]) % mod + (my[o].f2 * fib[len + 1] % mod) -
                 my[o].f2 + mod) %
                    mod;
    my[o].sum %= mod;
  }
  void push_down(int o, int l, int r) {
    if (!my[o].f1 && !my[o].f2) return;
    int mid = (l + r) / 2;
    my[(o << 1)].f1 += my[o].f1;
    my[(o << 1 | 1)].f1 +=
        (my[o].f1 * fib[mid - l]) % mod + (my[o].f2 * fib[mid - l + 1]) % mod;
    my[(o << 1)].f2 += my[o].f2;
    my[(o << 1 | 1)].f2 += (my[o].f1 * fib[mid - l + 1]) % mod +
                           (my[o].f2 * fib[mid - l + 2]) % mod;
    my[o].f1 = my[o].f2 = 0;
    push_up((o << 1), mid - l + 1);
    push_up((o << 1 | 1), r - mid);
  }
  void ins(int o, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) {
      my[o].f1 += fib[l - ql + 1];
      my[o].f1 %= mod;
      my[o].f2 += fib[l - ql + 2];
      my[o].f2 %= mod;
      push_up(o, r - l + 1);
      return;
    }
    push_down(o, l, r);
    int mid = (l + r) / 2;
    if (ql <= mid) ins((o << 1), l, mid, ql, qr);
    if (qr > mid) ins((o << 1 | 1), mid + 1, r, ql, qr);
    push_up(o, r - l + 1);
  }
  long long query(int o, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) {
      return my[o].sum;
    }
    push_down(o, l, r);
    int mid = (l + r) / 2;
    long long ans = 0;
    if (ql <= mid) ans += query((o << 1), l, mid, ql, qr);
    if (qr > mid) ans += query((o << 1 | 1), mid + 1, r, ql, qr);
    ans %= mod;
    return ans;
  }
} seg;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  int n, m;
  cin >> n >> m;
  fib[1] = fib[2] = 1;
  for (int i = 3; i <= n + 3; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
  for (int i = 1; i <= n; i++) cin >> a[i], sum[i] = (sum[i - 1] + a[i]) % mod;
  while (m--) {
    int op, l, r;
    cin >> op >> l >> r;
    if (op == 1)
      seg.ins(1, 1, n, l, r);
    else
      cout << (seg.query(1, 1, n, l, r) + (sum[r] - sum[l - 1]) % mod + mod) %
                  mod
           << endl;
  }
  return 0;
}

```