#include <bits/stdc++.h>
using namespace std;
const long long M = 1000000009, N = 300010;
long long F1[N], F2[N], f1[N], f2[N], Fib[N], fib[N], st[N * 4], lazy[N * 4][3],
    l, r, n, m, flag, a[N], s[N];
inline long long P(long long x) { return x >= M ? x % M : x; }
long long get(long long x, long long y, long long z) {
  return x * f1[z] + y * f2[z];
}
void pushdown(long long ind, long long be, long long en) {
  long long mid = (be + en) >> 1;
  st[ind << 1] = P(st[ind << 1] + P(F1[mid - be + 1] * lazy[ind][1]) +
                   P(F2[mid - be + 1] * lazy[ind][2]));
  st[ind << 1 | 1] =
      P(st[ind << 1 | 1] +
        P(P(F1[en - be + 1] - F1[mid - be + 1] + M) * lazy[ind][1]) +
        P(P(F2[en - be + 1] - F2[mid - be + 1] + M) * lazy[ind][2]));
  lazy[ind << 1][1] = P(lazy[ind << 1][1] + lazy[ind][1]);
  lazy[ind << 1][2] = P(lazy[ind << 1][2] + lazy[ind][2]);
  lazy[ind << 1 | 1][1] =
      P(lazy[ind << 1 | 1][1] + get(lazy[ind][1], lazy[ind][2], mid - be + 2));
  lazy[ind << 1 | 1][2] =
      P(lazy[ind << 1 | 1][2] + get(lazy[ind][1], lazy[ind][2], mid - be + 3));
  lazy[ind][1] = lazy[ind][2] = 0;
}
void update(long long ind, long long be, long long en) {
  if (l <= be && en <= r) {
    st[ind] = P(st[ind] + P(Fib[en - l + 1] - Fib[be - l] + M));
    lazy[ind][1] = P(lazy[ind][1] + fib[be - l + 1]);
    lazy[ind][2] = P(lazy[ind][2] + fib[be - l + 2]);
    return;
  }
  if (be < en) pushdown(ind, be, en);
  long long mid = (be + en) >> 1;
  if (l <= mid) update(ind << 1, be, mid);
  if (r >= mid + 1) update(ind << 1 | 1, mid + 1, en);
  st[ind] = P(st[ind << 1] + st[ind << 1 | 1]);
}
long long ask(long long ind, long long be, long long en) {
  if (l <= be && en <= r) return st[ind];
  if (be < en) pushdown(ind, be, en);
  long long mid = (be + en) >> 1, res = 0;
  if (l <= mid) res = P(res + ask(ind << 1, be, mid));
  if (r >= mid + 1) res = P(res + ask(ind << 1 | 1, mid + 1, en));
  st[ind] = P(st[ind << 1] + st[ind << 1 | 1]);
  return res;
}
void prework() {
  f1[1] = 1;
  for (long long i = 3; i <= 300000; i++) f1[i] = P(f1[i - 1] + f1[i - 2]);
  f2[2] = 1;
  for (long long i = 3; i <= 300000; i++) f2[i] = P(f2[i - 1] + f2[i - 2]);
  for (int i = 1; i <= 300000; i++) fib[i] = P(f1[i] + f2[i]);
  for (long long i = 1; i <= 300000; i++) F1[i] = P(f1[i] + F1[i - 1]);
  for (long long i = 1; i <= 300000; i++) F2[i] = P(f2[i] + F2[i - 1]);
  for (long long i = 1; i <= 300000; i++) Fib[i] = P(F1[i] + F2[i]);
}
int main() {
  prework();
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    s[i] = P(s[i - 1] + a[i]);
  }
  for (long long i = 1; i <= m; i++) {
    scanf("%lld%lld%lld", &flag, &l, &r);
    if (flag == 1)
      update(1, 1, n);
    else
      printf("%lld\n", P(P(s[r] - s[l - 1] + M) + ask(1, 1, n)));
  }
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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 M = 1000000009, N = 300010;
long long F1[N], F2[N], f1[N], f2[N], Fib[N], fib[N], st[N * 4], lazy[N * 4][3],
    l, r, n, m, flag, a[N], s[N];
inline long long P(long long x) { return x >= M ? x % M : x; }
long long get(long long x, long long y, long long z) {
  return x * f1[z] + y * f2[z];
}
void pushdown(long long ind, long long be, long long en) {
  long long mid = (be + en) >> 1;
  st[ind << 1] = P(st[ind << 1] + P(F1[mid - be + 1] * lazy[ind][1]) +
                   P(F2[mid - be + 1] * lazy[ind][2]));
  st[ind << 1 | 1] =
      P(st[ind << 1 | 1] +
        P(P(F1[en - be + 1] - F1[mid - be + 1] + M) * lazy[ind][1]) +
        P(P(F2[en - be + 1] - F2[mid - be + 1] + M) * lazy[ind][2]));
  lazy[ind << 1][1] = P(lazy[ind << 1][1] + lazy[ind][1]);
  lazy[ind << 1][2] = P(lazy[ind << 1][2] + lazy[ind][2]);
  lazy[ind << 1 | 1][1] =
      P(lazy[ind << 1 | 1][1] + get(lazy[ind][1], lazy[ind][2], mid - be + 2));
  lazy[ind << 1 | 1][2] =
      P(lazy[ind << 1 | 1][2] + get(lazy[ind][1], lazy[ind][2], mid - be + 3));
  lazy[ind][1] = lazy[ind][2] = 0;
}
void update(long long ind, long long be, long long en) {
  if (l <= be && en <= r) {
    st[ind] = P(st[ind] + P(Fib[en - l + 1] - Fib[be - l] + M));
    lazy[ind][1] = P(lazy[ind][1] + fib[be - l + 1]);
    lazy[ind][2] = P(lazy[ind][2] + fib[be - l + 2]);
    return;
  }
  if (be < en) pushdown(ind, be, en);
  long long mid = (be + en) >> 1;
  if (l <= mid) update(ind << 1, be, mid);
  if (r >= mid + 1) update(ind << 1 | 1, mid + 1, en);
  st[ind] = P(st[ind << 1] + st[ind << 1 | 1]);
}
long long ask(long long ind, long long be, long long en) {
  if (l <= be && en <= r) return st[ind];
  if (be < en) pushdown(ind, be, en);
  long long mid = (be + en) >> 1, res = 0;
  if (l <= mid) res = P(res + ask(ind << 1, be, mid));
  if (r >= mid + 1) res = P(res + ask(ind << 1 | 1, mid + 1, en));
  st[ind] = P(st[ind << 1] + st[ind << 1 | 1]);
  return res;
}
void prework() {
  f1[1] = 1;
  for (long long i = 3; i <= 300000; i++) f1[i] = P(f1[i - 1] + f1[i - 2]);
  f2[2] = 1;
  for (long long i = 3; i <= 300000; i++) f2[i] = P(f2[i - 1] + f2[i - 2]);
  for (int i = 1; i <= 300000; i++) fib[i] = P(f1[i] + f2[i]);
  for (long long i = 1; i <= 300000; i++) F1[i] = P(f1[i] + F1[i - 1]);
  for (long long i = 1; i <= 300000; i++) F2[i] = P(f2[i] + F2[i - 1]);
  for (long long i = 1; i <= 300000; i++) Fib[i] = P(F1[i] + F2[i]);
}
int main() {
  prework();
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    s[i] = P(s[i - 1] + a[i]);
  }
  for (long long i = 1; i <= m; i++) {
    scanf("%lld%lld%lld", &flag, &l, &r);
    if (flag == 1)
      update(1, 1, n);
    else
      printf("%lld\n", P(P(s[r] - s[l - 1] + M) + ask(1, 1, n)));
  }
  return 0;
}

```