#include <bits/stdc++.h>
using namespace std;
struct mat {
  int dgt[2][2];
  friend mat operator*(const mat &a, const mat &b) {
    mat c;
    memset(c.dgt, 0, sizeof(c.dgt));
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          c.dgt[i][j] =
              (c.dgt[i][j] + (long long)a.dgt[i][k] * b.dgt[k][j]) % 1000000009;
    return c;
  }
  friend bool operator!=(const mat &a, const mat &b) {
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        if (a.dgt[i][j] != b.dgt[i][j]) return 1;
    return 0;
  }
  friend mat operator+(const mat &a, const mat &b) {
    mat c;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        c.dgt[i][j] = (a.dgt[i][j] + b.dgt[i][j]) % 1000000009;
    return c;
  }
} I, fib, Power[300010], sum[300010], O;
struct SegTree {
  int size, ans;
  mat p;
} tree[300010 << 2];
int n, m, a[300010];
void build(int root, int l, int r) {
  if (l == r) {
    tree[root].size = 1;
    tree[root].ans = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(root << 1, l, mid), build(root << 1 | 1, mid + 1, r);
  tree[root].size = tree[root << 1].size + tree[root << 1 | 1].size,
  tree[root].ans = (tree[root << 1].ans + tree[root << 1 | 1].ans) % 1000000009;
}
void update(int root, mat p) {
  tree[root].p = tree[root].p + p;
  p = p * sum[tree[root].size - 1];
  tree[root].ans = (tree[root].ans + p.dgt[0][1]) % 1000000009;
}
void pd(int root) {
  if (tree[root].p != O) {
    update(root << 1, tree[root].p);
    update(root << 1 | 1, tree[root].p * Power[tree[root << 1].size]);
    tree[root].p = O;
  }
}
int query(int root, int l, int r, int x, int y) {
  if (l == x && r == y) return tree[root].ans;
  pd(root);
  int mid = (l + r) >> 1;
  if (y <= mid)
    return query(root << 1, l, mid, x, y);
  else if (mid < x)
    return query(root << 1 | 1, mid + 1, r, x, y);
  else
    return (query(root << 1, l, mid, x, mid) +
            query(root << 1 | 1, mid + 1, r, mid + 1, y)) %
           1000000009;
}
void modify(int root, int l, int r, int x, int y, mat p) {
  if (l == x && r == y) {
    update(root, p);
    return;
  }
  pd(root);
  int mid = (l + r) >> 1;
  if (y <= mid)
    modify(root << 1, l, mid, x, y, p);
  else if (mid < x)
    modify(root << 1 | 1, mid + 1, r, x, y, p);
  else
    modify(root << 1, l, mid, x, mid, p),
        modify(root << 1 | 1, mid + 1, r, mid + 1, y, p * Power[mid - x + 1]);
  tree[root].ans = (tree[root << 1].ans + tree[root << 1 | 1].ans) % 1000000009;
}
int main() {
  I.dgt[0][0] = I.dgt[1][1] = 1;
  fib.dgt[0][1] = 1;
  fib.dgt[1][0] = fib.dgt[1][1] = 1;
  scanf("%d %d", &n, &m);
  Power[0] = sum[0] = I;
  for (int i = 1; i <= n; ++i)
    Power[i] = Power[i - 1] * fib, sum[i] = sum[i - 1] + Power[i];
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  build(1, 1, n);
  for (int i = 1, t, l, r; i <= m; ++i) {
    scanf("%d %d %d", &t, &l, &r);
    if (t == 1)
      modify(1, 1, n, l, r, fib);
    else
      printf("%d\n", query(1, 1, n, l, r));
  }
  return 0;
}

### Prompt

Your task is to create 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;
struct mat {
  int dgt[2][2];
  friend mat operator*(const mat &a, const mat &b) {
    mat c;
    memset(c.dgt, 0, sizeof(c.dgt));
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          c.dgt[i][j] =
              (c.dgt[i][j] + (long long)a.dgt[i][k] * b.dgt[k][j]) % 1000000009;
    return c;
  }
  friend bool operator!=(const mat &a, const mat &b) {
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        if (a.dgt[i][j] != b.dgt[i][j]) return 1;
    return 0;
  }
  friend mat operator+(const mat &a, const mat &b) {
    mat c;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        c.dgt[i][j] = (a.dgt[i][j] + b.dgt[i][j]) % 1000000009;
    return c;
  }
} I, fib, Power[300010], sum[300010], O;
struct SegTree {
  int size, ans;
  mat p;
} tree[300010 << 2];
int n, m, a[300010];
void build(int root, int l, int r) {
  if (l == r) {
    tree[root].size = 1;
    tree[root].ans = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(root << 1, l, mid), build(root << 1 | 1, mid + 1, r);
  tree[root].size = tree[root << 1].size + tree[root << 1 | 1].size,
  tree[root].ans = (tree[root << 1].ans + tree[root << 1 | 1].ans) % 1000000009;
}
void update(int root, mat p) {
  tree[root].p = tree[root].p + p;
  p = p * sum[tree[root].size - 1];
  tree[root].ans = (tree[root].ans + p.dgt[0][1]) % 1000000009;
}
void pd(int root) {
  if (tree[root].p != O) {
    update(root << 1, tree[root].p);
    update(root << 1 | 1, tree[root].p * Power[tree[root << 1].size]);
    tree[root].p = O;
  }
}
int query(int root, int l, int r, int x, int y) {
  if (l == x && r == y) return tree[root].ans;
  pd(root);
  int mid = (l + r) >> 1;
  if (y <= mid)
    return query(root << 1, l, mid, x, y);
  else if (mid < x)
    return query(root << 1 | 1, mid + 1, r, x, y);
  else
    return (query(root << 1, l, mid, x, mid) +
            query(root << 1 | 1, mid + 1, r, mid + 1, y)) %
           1000000009;
}
void modify(int root, int l, int r, int x, int y, mat p) {
  if (l == x && r == y) {
    update(root, p);
    return;
  }
  pd(root);
  int mid = (l + r) >> 1;
  if (y <= mid)
    modify(root << 1, l, mid, x, y, p);
  else if (mid < x)
    modify(root << 1 | 1, mid + 1, r, x, y, p);
  else
    modify(root << 1, l, mid, x, mid, p),
        modify(root << 1 | 1, mid + 1, r, mid + 1, y, p * Power[mid - x + 1]);
  tree[root].ans = (tree[root << 1].ans + tree[root << 1 | 1].ans) % 1000000009;
}
int main() {
  I.dgt[0][0] = I.dgt[1][1] = 1;
  fib.dgt[0][1] = 1;
  fib.dgt[1][0] = fib.dgt[1][1] = 1;
  scanf("%d %d", &n, &m);
  Power[0] = sum[0] = I;
  for (int i = 1; i <= n; ++i)
    Power[i] = Power[i - 1] * fib, sum[i] = sum[i - 1] + Power[i];
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  build(1, 1, n);
  for (int i = 1, t, l, r; i <= m; ++i) {
    scanf("%d %d %d", &t, &l, &r);
    if (t == 1)
      modify(1, 1, n, l, r, fib);
    else
      printf("%d\n", query(1, 1, n, l, r));
  }
  return 0;
}

```