#include <bits/stdc++.h>
using namespace std;
struct node {
  int s, f1, f2;
} t[1200010];
int n, m, fib[300010];
void build(int l, int r, int n) {
  t[n].f1 = t[n].f2 = 0;
  if (l != r)
    build(l, ((l + r) >> 1), (n << 1)),
        build(((l + r) >> 1) + 1, r, ((n << 1) + 1)),
        t[n].s = (t[(n << 1)].s + t[((n << 1) + 1)].s) % 1000000009;
  else
    scanf("%d", &t[n].s);
}
int getf(int a, int b, int n) {
  if (n == 1) return a;
  if (n == 2) return b;
  return (1LL * a * fib[n - 2] % 1000000009 +
          1LL * b * fib[n - 1] % 1000000009) %
         1000000009;
}
int getsum(int a, int b, int n) {
  return (getf(a, b, n + 2) - b + 1000000009) % 1000000009;
}
void push(int l, int r, int n) {
  if (t[n].f1) {
    int x = t[n].f1, y = t[n].f2, ox = x, oy = y, ll = ((l + r) >> 1) - l + 1,
        rl = r - ((l + r) >> 1);
    t[(n << 1)].f1 = (t[(n << 1)].f1 + x) % 1000000009,
            t[(n << 1)].f2 = (t[(n << 1)].f2 + y) % 1000000009;
    t[(n << 1)].s = (t[(n << 1)].s + getsum(x, y, ll)) % 1000000009;
    x = getf(ox, oy, ll + 1), y = getf(ox, oy, ll + 2);
    t[((n << 1) + 1)].f1 = (t[((n << 1) + 1)].f1 + x) % 1000000009,
                  t[((n << 1) + 1)].f2 =
                      (t[((n << 1) + 1)].f2 + y) % 1000000009;
    t[((n << 1) + 1)].s = (t[((n << 1) + 1)].s + getsum(x, y, rl)) % 1000000009;
    t[n].f1 = t[n].f2 = 0;
  }
}
void updata(int ll, int rr, int l, int r, int n) {
  if ((ll <= l) && (r <= rr)) {
    t[n].f1 = (t[n].f1 + fib[l - ll + 1]) % 1000000009,
    t[n].f2 = (t[n].f2 + fib[l - ll + 2]) % 1000000009;
    t[n].s = (t[n].s + getsum(fib[l - ll + 1], fib[l - ll + 2], r - l + 1)) %
             1000000009;
  } else {
    push(l, r, n);
    if (ll <= ((l + r) >> 1)) updata(ll, rr, l, ((l + r) >> 1), (n << 1));
    if (((l + r) >> 1) < rr)
      updata(ll, rr, ((l + r) >> 1) + 1, r, ((n << 1) + 1));
    t[n].s = (t[(n << 1)].s + t[((n << 1) + 1)].s) % 1000000009;
  }
}
int query(int ll, int rr, int l, int r, int n) {
  if ((ll <= l) && (r <= rr))
    return t[n].s;
  else {
    push(l, r, n);
    int res = 0;
    if (ll <= ((l + r) >> 1)) res += query(ll, rr, l, ((l + r) >> 1), (n << 1));
    if (((l + r) >> 1) < rr)
      res += query(ll, rr, ((l + r) >> 1) + 1, r, ((n << 1) + 1));
    t[n].s = (t[(n << 1)].s + t[((n << 1) + 1)].s) % 1000000009;
    return res % 1000000009;
  }
}
void work() {
  scanf("%d %d", &n, &m);
  fib[1] = fib[2] = 1;
  for (int i = 3; i <= n + 2; i++)
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000009;
  build(1, n, 1);
  for (int i = 1, k, l, r; i <= m; i++) {
    scanf("%d %d %d", &k, &l, &r);
    if (k == 1)
      updata(l, r, 1, n, 1);
    else
      printf("%d\n", query(l, r, 1, n, 1));
  }
}
int main() {
  work();
  return 0;
}

### Prompt

Create a solution in cpp for 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 node {
  int s, f1, f2;
} t[1200010];
int n, m, fib[300010];
void build(int l, int r, int n) {
  t[n].f1 = t[n].f2 = 0;
  if (l != r)
    build(l, ((l + r) >> 1), (n << 1)),
        build(((l + r) >> 1) + 1, r, ((n << 1) + 1)),
        t[n].s = (t[(n << 1)].s + t[((n << 1) + 1)].s) % 1000000009;
  else
    scanf("%d", &t[n].s);
}
int getf(int a, int b, int n) {
  if (n == 1) return a;
  if (n == 2) return b;
  return (1LL * a * fib[n - 2] % 1000000009 +
          1LL * b * fib[n - 1] % 1000000009) %
         1000000009;
}
int getsum(int a, int b, int n) {
  return (getf(a, b, n + 2) - b + 1000000009) % 1000000009;
}
void push(int l, int r, int n) {
  if (t[n].f1) {
    int x = t[n].f1, y = t[n].f2, ox = x, oy = y, ll = ((l + r) >> 1) - l + 1,
        rl = r - ((l + r) >> 1);
    t[(n << 1)].f1 = (t[(n << 1)].f1 + x) % 1000000009,
            t[(n << 1)].f2 = (t[(n << 1)].f2 + y) % 1000000009;
    t[(n << 1)].s = (t[(n << 1)].s + getsum(x, y, ll)) % 1000000009;
    x = getf(ox, oy, ll + 1), y = getf(ox, oy, ll + 2);
    t[((n << 1) + 1)].f1 = (t[((n << 1) + 1)].f1 + x) % 1000000009,
                  t[((n << 1) + 1)].f2 =
                      (t[((n << 1) + 1)].f2 + y) % 1000000009;
    t[((n << 1) + 1)].s = (t[((n << 1) + 1)].s + getsum(x, y, rl)) % 1000000009;
    t[n].f1 = t[n].f2 = 0;
  }
}
void updata(int ll, int rr, int l, int r, int n) {
  if ((ll <= l) && (r <= rr)) {
    t[n].f1 = (t[n].f1 + fib[l - ll + 1]) % 1000000009,
    t[n].f2 = (t[n].f2 + fib[l - ll + 2]) % 1000000009;
    t[n].s = (t[n].s + getsum(fib[l - ll + 1], fib[l - ll + 2], r - l + 1)) %
             1000000009;
  } else {
    push(l, r, n);
    if (ll <= ((l + r) >> 1)) updata(ll, rr, l, ((l + r) >> 1), (n << 1));
    if (((l + r) >> 1) < rr)
      updata(ll, rr, ((l + r) >> 1) + 1, r, ((n << 1) + 1));
    t[n].s = (t[(n << 1)].s + t[((n << 1) + 1)].s) % 1000000009;
  }
}
int query(int ll, int rr, int l, int r, int n) {
  if ((ll <= l) && (r <= rr))
    return t[n].s;
  else {
    push(l, r, n);
    int res = 0;
    if (ll <= ((l + r) >> 1)) res += query(ll, rr, l, ((l + r) >> 1), (n << 1));
    if (((l + r) >> 1) < rr)
      res += query(ll, rr, ((l + r) >> 1) + 1, r, ((n << 1) + 1));
    t[n].s = (t[(n << 1)].s + t[((n << 1) + 1)].s) % 1000000009;
    return res % 1000000009;
  }
}
void work() {
  scanf("%d %d", &n, &m);
  fib[1] = fib[2] = 1;
  for (int i = 3; i <= n + 2; i++)
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000009;
  build(1, n, 1);
  for (int i = 1, k, l, r; i <= m; i++) {
    scanf("%d %d %d", &k, &l, &r);
    if (k == 1)
      updata(l, r, 1, n, 1);
    else
      printf("%d\n", query(l, r, 1, n, 1));
  }
}
int main() {
  work();
  return 0;
}

```