#include <bits/stdc++.h>
using namespace std;
int n, m;
long long a[333333];
const long long MOD = 1000000009;
long long fib[333333];
long long fsum[333333];
inline const long long getFsum(const int l, const int r) {
  return ((fsum[r] - fsum[l - 1]) + MOD) % MOD;
}
inline void pllAdd(pair<long long, long long>& des,
                   const pair<long long, long long>& toAdd) {
  if (des.first < 0) des = pair<long long, long long>(0, 0);
  des.first += toAdd.first;
  des.second += toAdd.second;
  des.first %= MOD;
  des.second %= MOD;
}
class a_sum {
 public:
  vector<long long> c;
  vector<pair<long long, long long> > lazy;
  a_sum() {
    c = vector<long long>(4 * n + 1, 0);
    lazy = vector<pair<long long, long long> >(
        4 * n + 1, pair<long long, long long>(-1, -1));
    for (int i = 1; i <= n; i++) init(i);
  }
  void init(const int index, const int nodeLeft, const int nodeRight,
            const int node) {
    c[node] += a[index];
    c[node] %= MOD;
    if (nodeLeft == nodeRight) return;
    int mid = (nodeLeft + nodeRight) / 2;
    if (index <= mid)
      init(index, nodeLeft, mid, node * 2);
    else
      init(index, mid + 1, nodeRight, node * 2 + 1);
  }
  void init(const int index) { init(index, 1, n, 1); }
  long long query(const int left, const int right, const int nodeLeft,
                  const int nodeRight, const int node) {
    int mid = (nodeLeft + nodeRight) / 2;
    if (lazy[node].first >= 0) {
      const long long a = lazy[node].first, b = lazy[node].second;
      int size = nodeRight - nodeLeft + 1;
      if (size == 1) {
        c[node] += a;
        c[node] %= MOD;
      } else {
        const long long x = getFsum(1, size - 2) + 1, y = getFsum(1, size - 1);
        long long toAdd = ((a * x) % MOD + (b * y) % MOD) % MOD;
        c[node] += toAdd;
        c[node] %= MOD;
        pllAdd(lazy[node * 2], pair<long long, long long>(a, b));
        int nextIndex = mid - nodeLeft + 2;
        pllAdd(lazy[node * 2 + 1],
               pair<long long, long long>(((a * fib[nextIndex - 2]) % MOD +
                                           b * fib[nextIndex - 1] % MOD) %
                                              MOD,
                                          ((a * fib[nextIndex - 1]) % MOD +
                                           (b * fib[nextIndex]) % MOD) %
                                              MOD));
      }
      lazy[node] = pair<long long, long long>(-1, -1);
    }
    if (left <= nodeLeft && nodeRight <= right) return c[node];
    if (nodeLeft > right || nodeRight < left) return 0;
    return (query(left, right, nodeLeft, mid, node * 2) +
            query(left, right, mid + 1, nodeRight, node * 2 + 1)) %
           MOD;
  }
  long long query(const int left, const int right) {
    return query(left, right, 1, n, 1);
  }
  void modify(const int left, const int right, const int nodeLeft,
              const int nodeRight, const int node) {
    int mid = (nodeLeft + nodeRight) / 2;
    if (lazy[node].first >= 0) {
      const long long a = lazy[node].first, b = lazy[node].second;
      int size = nodeRight - nodeLeft + 1;
      if (size == 1) {
        c[node] += a;
        c[node] %= MOD;
      } else {
        const long long x = getFsum(1, size - 2) + 1, y = getFsum(1, size - 1);
        long long toAdd = ((a * x) % MOD + (b * y) % MOD) % MOD;
        c[node] += toAdd;
        c[node] %= MOD;
        pllAdd(lazy[node * 2], pair<long long, long long>(a, b));
        int nextIndex = mid - nodeLeft + 2;
        pllAdd(lazy[node * 2 + 1],
               pair<long long, long long>(((a * fib[nextIndex - 2]) % MOD +
                                           b * fib[nextIndex - 1] % MOD) %
                                              MOD,
                                          ((a * fib[nextIndex - 1]) % MOD +
                                           (b * fib[nextIndex]) % MOD) %
                                              MOD));
      }
      lazy[node] = pair<long long, long long>(-1, -1);
    }
    if (nodeLeft > right || nodeRight < left) return;
    if (left <= nodeLeft && nodeRight <= right) {
      long long toAdd = getFsum(nodeLeft - left + 1, nodeRight - left + 1);
      c[node] += toAdd;
      c[node] %= MOD;
      if (nodeLeft != nodeRight) {
        pllAdd(lazy[node * 2],
               pair<long long, long long>(fib[nodeLeft - left + 1],
                                          fib[nodeLeft - left + 2]));
        pllAdd(lazy[node * 2 + 1],
               pair<long long, long long>(fib[mid - left + 2],
                                          fib[mid - left + 3]));
      }
      return;
    }
    modify(left, right, nodeLeft, mid, node * 2);
    modify(left, right, mid + 1, nodeRight, node * 2 + 1);
    c[node] = (c[node * 2] + c[node * 2 + 1]) % MOD;
  }
  void modify(const int left, const int right) { modify(left, right, 1, n, 1); }
};
int main() {
  fib[1] = fib[2] = 1;
  for (int i = 3; i <= 300000; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;
  for (int i = 1; i <= 300000; i++) fsum[i] = (fsum[i - 1] + fib[i]) % MOD;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  a_sum g = a_sum();
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    if (x == 1)
      g.modify(y, z);
    else
      cout << g.query(y, z) << endl;
  }
}

### Prompt

Your challenge is to write 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;
int n, m;
long long a[333333];
const long long MOD = 1000000009;
long long fib[333333];
long long fsum[333333];
inline const long long getFsum(const int l, const int r) {
  return ((fsum[r] - fsum[l - 1]) + MOD) % MOD;
}
inline void pllAdd(pair<long long, long long>& des,
                   const pair<long long, long long>& toAdd) {
  if (des.first < 0) des = pair<long long, long long>(0, 0);
  des.first += toAdd.first;
  des.second += toAdd.second;
  des.first %= MOD;
  des.second %= MOD;
}
class a_sum {
 public:
  vector<long long> c;
  vector<pair<long long, long long> > lazy;
  a_sum() {
    c = vector<long long>(4 * n + 1, 0);
    lazy = vector<pair<long long, long long> >(
        4 * n + 1, pair<long long, long long>(-1, -1));
    for (int i = 1; i <= n; i++) init(i);
  }
  void init(const int index, const int nodeLeft, const int nodeRight,
            const int node) {
    c[node] += a[index];
    c[node] %= MOD;
    if (nodeLeft == nodeRight) return;
    int mid = (nodeLeft + nodeRight) / 2;
    if (index <= mid)
      init(index, nodeLeft, mid, node * 2);
    else
      init(index, mid + 1, nodeRight, node * 2 + 1);
  }
  void init(const int index) { init(index, 1, n, 1); }
  long long query(const int left, const int right, const int nodeLeft,
                  const int nodeRight, const int node) {
    int mid = (nodeLeft + nodeRight) / 2;
    if (lazy[node].first >= 0) {
      const long long a = lazy[node].first, b = lazy[node].second;
      int size = nodeRight - nodeLeft + 1;
      if (size == 1) {
        c[node] += a;
        c[node] %= MOD;
      } else {
        const long long x = getFsum(1, size - 2) + 1, y = getFsum(1, size - 1);
        long long toAdd = ((a * x) % MOD + (b * y) % MOD) % MOD;
        c[node] += toAdd;
        c[node] %= MOD;
        pllAdd(lazy[node * 2], pair<long long, long long>(a, b));
        int nextIndex = mid - nodeLeft + 2;
        pllAdd(lazy[node * 2 + 1],
               pair<long long, long long>(((a * fib[nextIndex - 2]) % MOD +
                                           b * fib[nextIndex - 1] % MOD) %
                                              MOD,
                                          ((a * fib[nextIndex - 1]) % MOD +
                                           (b * fib[nextIndex]) % MOD) %
                                              MOD));
      }
      lazy[node] = pair<long long, long long>(-1, -1);
    }
    if (left <= nodeLeft && nodeRight <= right) return c[node];
    if (nodeLeft > right || nodeRight < left) return 0;
    return (query(left, right, nodeLeft, mid, node * 2) +
            query(left, right, mid + 1, nodeRight, node * 2 + 1)) %
           MOD;
  }
  long long query(const int left, const int right) {
    return query(left, right, 1, n, 1);
  }
  void modify(const int left, const int right, const int nodeLeft,
              const int nodeRight, const int node) {
    int mid = (nodeLeft + nodeRight) / 2;
    if (lazy[node].first >= 0) {
      const long long a = lazy[node].first, b = lazy[node].second;
      int size = nodeRight - nodeLeft + 1;
      if (size == 1) {
        c[node] += a;
        c[node] %= MOD;
      } else {
        const long long x = getFsum(1, size - 2) + 1, y = getFsum(1, size - 1);
        long long toAdd = ((a * x) % MOD + (b * y) % MOD) % MOD;
        c[node] += toAdd;
        c[node] %= MOD;
        pllAdd(lazy[node * 2], pair<long long, long long>(a, b));
        int nextIndex = mid - nodeLeft + 2;
        pllAdd(lazy[node * 2 + 1],
               pair<long long, long long>(((a * fib[nextIndex - 2]) % MOD +
                                           b * fib[nextIndex - 1] % MOD) %
                                              MOD,
                                          ((a * fib[nextIndex - 1]) % MOD +
                                           (b * fib[nextIndex]) % MOD) %
                                              MOD));
      }
      lazy[node] = pair<long long, long long>(-1, -1);
    }
    if (nodeLeft > right || nodeRight < left) return;
    if (left <= nodeLeft && nodeRight <= right) {
      long long toAdd = getFsum(nodeLeft - left + 1, nodeRight - left + 1);
      c[node] += toAdd;
      c[node] %= MOD;
      if (nodeLeft != nodeRight) {
        pllAdd(lazy[node * 2],
               pair<long long, long long>(fib[nodeLeft - left + 1],
                                          fib[nodeLeft - left + 2]));
        pllAdd(lazy[node * 2 + 1],
               pair<long long, long long>(fib[mid - left + 2],
                                          fib[mid - left + 3]));
      }
      return;
    }
    modify(left, right, nodeLeft, mid, node * 2);
    modify(left, right, mid + 1, nodeRight, node * 2 + 1);
    c[node] = (c[node * 2] + c[node * 2 + 1]) % MOD;
  }
  void modify(const int left, const int right) { modify(left, right, 1, n, 1); }
};
int main() {
  fib[1] = fib[2] = 1;
  for (int i = 3; i <= 300000; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;
  for (int i = 1; i <= 300000; i++) fsum[i] = (fsum[i - 1] + fib[i]) % MOD;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  a_sum g = a_sum();
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    if (x == 1)
      g.modify(y, z);
    else
      cout << g.query(y, z) << endl;
  }
}

```