#include <bits/stdc++.h>
const int mod = 1e9 + 9;
const int N = 333333;
struct Matrix {
  int n, m;
  int item[2][2];
  Matrix() { memset(item, 0, sizeof(item)); }
  friend Matrix operator*(const Matrix &a, const Matrix &b) {
    Matrix c;
    c.n = a.n;
    c.m = b.m;
    for (int i = 0; i < c.n; ++i) {
      for (int j = 0; j < c.m; ++j) {
        for (int k = 0; k < a.m; ++k) {
          (c.item[i][j] += 1LL * a.item[i][k] * b.item[k][j] % mod) %= mod;
        }
      }
    }
    return c;
  }
  void print() const {
    for (int i = 0; i < n; ++i, puts("")) {
      for (int j = 0; j < m; ++j, putchar(' ')) {
        printf("%d", item[i][j]);
      }
    }
  }
};
Matrix A, I, T[N];
int fetch(const std::pair<int, int> &start, int i) {
  if (i == 1) {
    return start.first;
  } else if (i == 2) {
    return start.second;
  } else {
    A.n = 2;
    A.m = 1;
    A.item[0][0] = start.second;
    A.item[1][0] = start.first;
    return (T[i - 2] * A).item[0][0];
  }
}
int accumulate(const std::pair<int, int> &start, int i) {
  if (i == 1) {
    return start.first;
  } else if (i == 2) {
    return (start.first + start.second) % mod;
  } else {
    return ((fetch(start, i + 2) - start.second) % mod + mod) % mod;
  }
}
std::pair<int, int> skip(const std::pair<int, int> &start, int step) {
  return std::make_pair(fetch(start, step + 1), fetch(start, step + 2));
}
int sum[N << 2];
std::pair<int, int> tag[N << 2];
void update(int x) { sum[x] = (sum[x << 1] + sum[x << 1 | 1]) % mod; }
void modify(int x, int l, int r, const std::pair<int, int> &val) {
  (sum[x] += accumulate(val, r - l + 1)) %= mod;
  (tag[x].first += val.first) %= mod;
  (tag[x].second += val.second) %= mod;
}
void release(int x, int l, int r) {
  if (tag[x] != std::make_pair(0, 0)) {
    int mid = l + r >> 1;
    modify(x << 1, l, mid, tag[x]);
    modify(x << 1 | 1, mid + 1, r, skip(tag[x], mid + 1 - l));
    tag[x] = std::make_pair(0, 0);
  }
}
void modify(int x, int l, int r, int ql, int qr) {
  if (qr < l || r < ql) {
    return;
  }
  if (ql <= l && r <= qr) {
    modify(x, l, r, skip(std::make_pair(1, 1), l - ql));
    return;
  }
  release(x, l, r);
  int mid = l + r >> 1;
  modify(x << 1, l, mid, ql, qr);
  modify(x << 1 | 1, mid + 1, r, ql, qr);
  update(x);
}
int query(int x, int l, int r, int ql, int qr) {
  if (qr < l || r < ql) {
    return 0;
  }
  if (ql <= l && r <= qr) {
    return sum[x];
  }
  release(x, l, r);
  int mid = l + r >> 1;
  return (query(x << 1, l, mid, ql, qr) +
          query(x << 1 | 1, mid + 1, r, ql, qr)) %
         mod;
}
int n;
int a[N];
void build(int x, int l, int r) {
  if (l == r) {
    sum[x] = a[l];
  } else {
    int mid = l + r >> 1;
    build(x << 1, l, mid);
    build(x << 1 | 1, mid + 1, r);
    update(x);
  }
}
int main(void) {
  int m;
  scanf("%d%d", &n, &m);
  I.n = 2;
  I.m = 2;
  I.item[0][0] = 1;
  I.item[0][1] = 0;
  I.item[1][0] = 0;
  I.item[1][1] = 1;
  T[1].n = 2;
  T[1].m = 2;
  T[1].item[0][0] = 1;
  T[1].item[0][1] = 1;
  T[1].item[1][0] = 1;
  T[1].item[1][1] = 0;
  for (int i = 2; i <= n; ++i) {
    T[i] = T[i - 1] * T[1];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
  }
  build(1, 1, n);
  for (; m--;) {
    int type, l, r;
    scanf("%d%d%d", &type, &l, &r);
    if (type == 1) {
      modify(1, 1, n, l, r);
    } else {
      printf("%d\n", query(1, 1, n, l, r));
    }
  }
}

### 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>
const int mod = 1e9 + 9;
const int N = 333333;
struct Matrix {
  int n, m;
  int item[2][2];
  Matrix() { memset(item, 0, sizeof(item)); }
  friend Matrix operator*(const Matrix &a, const Matrix &b) {
    Matrix c;
    c.n = a.n;
    c.m = b.m;
    for (int i = 0; i < c.n; ++i) {
      for (int j = 0; j < c.m; ++j) {
        for (int k = 0; k < a.m; ++k) {
          (c.item[i][j] += 1LL * a.item[i][k] * b.item[k][j] % mod) %= mod;
        }
      }
    }
    return c;
  }
  void print() const {
    for (int i = 0; i < n; ++i, puts("")) {
      for (int j = 0; j < m; ++j, putchar(' ')) {
        printf("%d", item[i][j]);
      }
    }
  }
};
Matrix A, I, T[N];
int fetch(const std::pair<int, int> &start, int i) {
  if (i == 1) {
    return start.first;
  } else if (i == 2) {
    return start.second;
  } else {
    A.n = 2;
    A.m = 1;
    A.item[0][0] = start.second;
    A.item[1][0] = start.first;
    return (T[i - 2] * A).item[0][0];
  }
}
int accumulate(const std::pair<int, int> &start, int i) {
  if (i == 1) {
    return start.first;
  } else if (i == 2) {
    return (start.first + start.second) % mod;
  } else {
    return ((fetch(start, i + 2) - start.second) % mod + mod) % mod;
  }
}
std::pair<int, int> skip(const std::pair<int, int> &start, int step) {
  return std::make_pair(fetch(start, step + 1), fetch(start, step + 2));
}
int sum[N << 2];
std::pair<int, int> tag[N << 2];
void update(int x) { sum[x] = (sum[x << 1] + sum[x << 1 | 1]) % mod; }
void modify(int x, int l, int r, const std::pair<int, int> &val) {
  (sum[x] += accumulate(val, r - l + 1)) %= mod;
  (tag[x].first += val.first) %= mod;
  (tag[x].second += val.second) %= mod;
}
void release(int x, int l, int r) {
  if (tag[x] != std::make_pair(0, 0)) {
    int mid = l + r >> 1;
    modify(x << 1, l, mid, tag[x]);
    modify(x << 1 | 1, mid + 1, r, skip(tag[x], mid + 1 - l));
    tag[x] = std::make_pair(0, 0);
  }
}
void modify(int x, int l, int r, int ql, int qr) {
  if (qr < l || r < ql) {
    return;
  }
  if (ql <= l && r <= qr) {
    modify(x, l, r, skip(std::make_pair(1, 1), l - ql));
    return;
  }
  release(x, l, r);
  int mid = l + r >> 1;
  modify(x << 1, l, mid, ql, qr);
  modify(x << 1 | 1, mid + 1, r, ql, qr);
  update(x);
}
int query(int x, int l, int r, int ql, int qr) {
  if (qr < l || r < ql) {
    return 0;
  }
  if (ql <= l && r <= qr) {
    return sum[x];
  }
  release(x, l, r);
  int mid = l + r >> 1;
  return (query(x << 1, l, mid, ql, qr) +
          query(x << 1 | 1, mid + 1, r, ql, qr)) %
         mod;
}
int n;
int a[N];
void build(int x, int l, int r) {
  if (l == r) {
    sum[x] = a[l];
  } else {
    int mid = l + r >> 1;
    build(x << 1, l, mid);
    build(x << 1 | 1, mid + 1, r);
    update(x);
  }
}
int main(void) {
  int m;
  scanf("%d%d", &n, &m);
  I.n = 2;
  I.m = 2;
  I.item[0][0] = 1;
  I.item[0][1] = 0;
  I.item[1][0] = 0;
  I.item[1][1] = 1;
  T[1].n = 2;
  T[1].m = 2;
  T[1].item[0][0] = 1;
  T[1].item[0][1] = 1;
  T[1].item[1][0] = 1;
  T[1].item[1][1] = 0;
  for (int i = 2; i <= n; ++i) {
    T[i] = T[i - 1] * T[1];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
  }
  build(1, 1, n);
  for (; m--;) {
    int type, l, r;
    scanf("%d%d%d", &type, &l, &r);
    if (type == 1) {
      modify(1, 1, n, l, r);
    } else {
      printf("%d\n", query(1, 1, n, l, r));
    }
  }
}

```