#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const int mo = 1e9 + 9;
const int S = 383008016;
const int S_inv = 276601605;
const int A = 691504013;
const int B = 308495997;
int n, m, v[N], pA[N], pB[N];
namespace cipolla {
const int mo = 1e9 + 9;
int a, t;
struct Node {
  int x, y;
  Node operator*(const Node &b) const {
    return (Node){
        (int)((1ll * x * b.x % mo + 1ll * y * b.y % mo * t % mo) % mo),
        (int)((1ll * x * b.y % mo + 1ll * y * b.x % mo) % mo)};
  }
};
int qpow(int a, int b) {
  int ans = 1;
  for (; b >= 1; b >>= 1, a = 1ll * a * a % mo)
    if (b & 1) ans = 1ll * ans * a % mo;
  return ans;
}
Node nqpow(Node a, int b) {
  Node ans = (Node){1, 0};
  for (; b >= 1; b >>= 1, a = a * a)
    if (b & 1) ans = ans * a;
  return ans;
}
int sqrt(int n) {
  a = 1;
  srand(time(0));
  while (qpow(((t = (1ll * a * a % mo - n) % mo + mo) % mo), (mo - 1) / 2) !=
         mo - 1)
    a = 1ll * rand() * rand() % mo;
  return nqpow((Node){a, 1}, (mo + 1) / 2).x;
}
}  // namespace cipolla
namespace seg1 {
int s[N << 2], fir[N << 2], nl, nr;
void add(int u, int p, int l, int r) {
  (s[u] += p == 0 ? 0 : p * (pA[r - l + 1] - 1ll) % mo * A % mo) %= mo;
  (fir[u] += p) %= mo;
}
void pd(int u, int l, int r) {
  if (fir[u]) {
    int mid = (l + r) >> 1;
    add(u << 1, fir[u], l, mid);
    add(u << 1 | 1, 1ll * fir[u] * pA[mid - l + 1] % mo, mid + 1, r);
    fir[u] = 0;
  }
}
void modify(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) {
    add(u, 1ll * S_inv * pA[l - nl + 1] % mo, l, r);
    return;
  }
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid)
    modify(u << 1, l, mid, ql, qr);
  else if (ql > mid)
    modify(u << 1 | 1, mid + 1, r, ql, qr);
  else {
    modify(u << 1, l, mid, ql, mid);
    modify(u << 1 | 1, mid + 1, r, mid + 1, qr);
  }
  s[u] = (s[u << 1] + s[u << 1 | 1]) % mo;
}
int qry(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) return s[u];
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid) return qry(u << 1, l, mid, ql, qr);
  if (ql > mid) return qry(u << 1 | 1, mid + 1, r, ql, qr);
  return (qry(u << 1, l, mid, ql, mid) +
          qry(u << 1 | 1, mid + 1, r, mid + 1, qr)) %
         mo;
}
}  // namespace seg1
namespace seg2 {
int s[N << 2], fir[N << 2], nl, nr;
void add(int u, int p, int l, int r) {
  (s[u] += p == 0 ? 0 : p * (pB[r - l + 1] - 1ll) % mo * B % mo) %= mo;
  (fir[u] += p) %= mo;
}
void pd(int u, int l, int r) {
  if (fir[u]) {
    int mid = (l + r) >> 1;
    add(u << 1, fir[u], l, mid);
    add(u << 1 | 1, 1ll * fir[u] * pB[mid - l + 1] % mo, mid + 1, r);
    fir[u] = 0;
  }
}
void modify(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) {
    add(u, 1ll * S_inv * pB[l - nl + 1] % mo, l, r);
    return;
  }
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid)
    modify(u << 1, l, mid, ql, qr);
  else if (ql > mid)
    modify(u << 1 | 1, mid + 1, r, ql, qr);
  else {
    modify(u << 1, l, mid, ql, mid);
    modify(u << 1 | 1, mid + 1, r, mid + 1, qr);
  }
  s[u] = (s[u << 1] + s[u << 1 | 1]) % mo;
}
int qry(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) return s[u];
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid) return qry(u << 1, l, mid, ql, qr);
  if (ql > mid) return qry(u << 1 | 1, mid + 1, r, ql, qr);
  return (qry(u << 1, l, mid, ql, mid) +
          qry(u << 1 | 1, mid + 1, r, mid + 1, qr)) %
         mo;
}
}  // namespace seg2
void solve(int l, int r) {
  seg1 ::nl = l;
  seg1 ::nr = r;
  seg1 ::modify(1, 1, n, l, r);
  seg2 ::nl = l;
  seg2 ::nr = r;
  seg2 ::modify(1, 1, n, l, r);
}
int query(int l, int r) {
  return (seg1 ::qry(1, 1, n, l, r) - seg2 ::qry(1, 1, n, l, r) + mo) % mo;
}
int main() {
  scanf("%d%d", &n, &m);
  pA[0] = pB[0] = 1;
  for (int i = 1; i <= n; i++) {
    pA[i] = 1ll * pA[i - 1] * A % mo;
    pB[i] = 1ll * pB[i - 1] * B % mo;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", v + i);
    (v[i] += v[i - 1]) %= mo;
  }
  for (int l, r, op, i = 1; i <= m; i++) {
    scanf("%d%d%d", &op, &l, &r);
    if (op == 1) solve(l, r);
    if (op == 2) {
      int ans = (v[r] - v[l - 1] + mo) % mo;
      printf("%d\n", (ans + query(l, r)) % mo);
    }
  }
  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 int N = 3e5 + 10;
const int mo = 1e9 + 9;
const int S = 383008016;
const int S_inv = 276601605;
const int A = 691504013;
const int B = 308495997;
int n, m, v[N], pA[N], pB[N];
namespace cipolla {
const int mo = 1e9 + 9;
int a, t;
struct Node {
  int x, y;
  Node operator*(const Node &b) const {
    return (Node){
        (int)((1ll * x * b.x % mo + 1ll * y * b.y % mo * t % mo) % mo),
        (int)((1ll * x * b.y % mo + 1ll * y * b.x % mo) % mo)};
  }
};
int qpow(int a, int b) {
  int ans = 1;
  for (; b >= 1; b >>= 1, a = 1ll * a * a % mo)
    if (b & 1) ans = 1ll * ans * a % mo;
  return ans;
}
Node nqpow(Node a, int b) {
  Node ans = (Node){1, 0};
  for (; b >= 1; b >>= 1, a = a * a)
    if (b & 1) ans = ans * a;
  return ans;
}
int sqrt(int n) {
  a = 1;
  srand(time(0));
  while (qpow(((t = (1ll * a * a % mo - n) % mo + mo) % mo), (mo - 1) / 2) !=
         mo - 1)
    a = 1ll * rand() * rand() % mo;
  return nqpow((Node){a, 1}, (mo + 1) / 2).x;
}
}  // namespace cipolla
namespace seg1 {
int s[N << 2], fir[N << 2], nl, nr;
void add(int u, int p, int l, int r) {
  (s[u] += p == 0 ? 0 : p * (pA[r - l + 1] - 1ll) % mo * A % mo) %= mo;
  (fir[u] += p) %= mo;
}
void pd(int u, int l, int r) {
  if (fir[u]) {
    int mid = (l + r) >> 1;
    add(u << 1, fir[u], l, mid);
    add(u << 1 | 1, 1ll * fir[u] * pA[mid - l + 1] % mo, mid + 1, r);
    fir[u] = 0;
  }
}
void modify(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) {
    add(u, 1ll * S_inv * pA[l - nl + 1] % mo, l, r);
    return;
  }
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid)
    modify(u << 1, l, mid, ql, qr);
  else if (ql > mid)
    modify(u << 1 | 1, mid + 1, r, ql, qr);
  else {
    modify(u << 1, l, mid, ql, mid);
    modify(u << 1 | 1, mid + 1, r, mid + 1, qr);
  }
  s[u] = (s[u << 1] + s[u << 1 | 1]) % mo;
}
int qry(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) return s[u];
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid) return qry(u << 1, l, mid, ql, qr);
  if (ql > mid) return qry(u << 1 | 1, mid + 1, r, ql, qr);
  return (qry(u << 1, l, mid, ql, mid) +
          qry(u << 1 | 1, mid + 1, r, mid + 1, qr)) %
         mo;
}
}  // namespace seg1
namespace seg2 {
int s[N << 2], fir[N << 2], nl, nr;
void add(int u, int p, int l, int r) {
  (s[u] += p == 0 ? 0 : p * (pB[r - l + 1] - 1ll) % mo * B % mo) %= mo;
  (fir[u] += p) %= mo;
}
void pd(int u, int l, int r) {
  if (fir[u]) {
    int mid = (l + r) >> 1;
    add(u << 1, fir[u], l, mid);
    add(u << 1 | 1, 1ll * fir[u] * pB[mid - l + 1] % mo, mid + 1, r);
    fir[u] = 0;
  }
}
void modify(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) {
    add(u, 1ll * S_inv * pB[l - nl + 1] % mo, l, r);
    return;
  }
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid)
    modify(u << 1, l, mid, ql, qr);
  else if (ql > mid)
    modify(u << 1 | 1, mid + 1, r, ql, qr);
  else {
    modify(u << 1, l, mid, ql, mid);
    modify(u << 1 | 1, mid + 1, r, mid + 1, qr);
  }
  s[u] = (s[u << 1] + s[u << 1 | 1]) % mo;
}
int qry(int u, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) return s[u];
  int mid = (l + r) >> 1;
  pd(u, l, r);
  if (qr <= mid) return qry(u << 1, l, mid, ql, qr);
  if (ql > mid) return qry(u << 1 | 1, mid + 1, r, ql, qr);
  return (qry(u << 1, l, mid, ql, mid) +
          qry(u << 1 | 1, mid + 1, r, mid + 1, qr)) %
         mo;
}
}  // namespace seg2
void solve(int l, int r) {
  seg1 ::nl = l;
  seg1 ::nr = r;
  seg1 ::modify(1, 1, n, l, r);
  seg2 ::nl = l;
  seg2 ::nr = r;
  seg2 ::modify(1, 1, n, l, r);
}
int query(int l, int r) {
  return (seg1 ::qry(1, 1, n, l, r) - seg2 ::qry(1, 1, n, l, r) + mo) % mo;
}
int main() {
  scanf("%d%d", &n, &m);
  pA[0] = pB[0] = 1;
  for (int i = 1; i <= n; i++) {
    pA[i] = 1ll * pA[i - 1] * A % mo;
    pB[i] = 1ll * pB[i - 1] * B % mo;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", v + i);
    (v[i] += v[i - 1]) %= mo;
  }
  for (int l, r, op, i = 1; i <= m; i++) {
    scanf("%d%d%d", &op, &l, &r);
    if (op == 1) solve(l, r);
    if (op == 2) {
      int ans = (v[r] - v[l - 1] + mo) % mo;
      printf("%d\n", (ans + query(l, r)) % mo);
    }
  }
  return 0;
}

```