#include <bits/stdc++.h>
long long n, m, a[300000], request, l, r, f[300000 + 10];
std::pair<long long, std::pair<long long, long long>> t[4 * 300000];
void build(long long i, long long tl, long long tr) {
  if (tr - tl == 1) {
    t[i] = {a[tl], {0, 0}};
    return;
  }
  long long tm = (tl + tr) / 2;
  build(2 * i + 1, tl, tm);
  build(2 * i + 2, tm, tr);
  t[i] = {(t[2 * i + 1].first + t[2 * i + 2].first) % 1000000009, {0, 0}};
  return;
}
long long get_f(long long a, long long b, long long k) {
  if (k == 0) {
    return 0;
  }
  if (k == 1) {
    return a;
  }
  return ((a * f[k - 2]) % 1000000009 + (b * f[k - 1]) % 1000000009) %
         1000000009;
}
void push(long long i, long long tl, long long tr) {
  if (tr - tl == 1) {
    t[i].first = (t[i].first + t[i].second.first) % 1000000009;
    t[i].second = {0, 0};
    return;
  }
  long long tm = (tl + tr) / 2;
  t[2 * i + 1].second.first =
      (t[2 * i + 1].second.first + t[i].second.first) % 1000000009;
  t[2 * i + 1].second.second =
      (t[2 * i + 1].second.second + t[i].second.second) % 1000000009;
  t[2 * i + 2].second.first =
      (t[2 * i + 2].second.first +
       get_f(t[i].second.first, t[i].second.second, tm - tl + 1)) %
      1000000009;
  t[2 * i + 2].second.second =
      (t[2 * i + 2].second.second +
       get_f(t[i].second.first, t[i].second.second, tm - tl + 2)) %
      1000000009;
  t[i].first =
      (t[i].first + get_f(t[i].second.first, t[i].second.second, tr - tl + 2) -
       get_f(t[i].second.first, t[i].second.second, 2) + 1000000009) %
      1000000009;
  t[i].second = {0, 0};
  return;
}
void update(long long i, long long tl, long long tr, long long l, long long r) {
  if (l <= tl && tr <= r) {
    t[i].second.first =
        (t[i].second.first + get_f(1, 1, tl - l + 1)) % 1000000009;
    t[i].second.second =
        (t[i].second.second + get_f(1, 1, tl - l + 2)) % 1000000009;
    return;
  }
  if (r <= tl || tr <= l) {
    return;
  }
  long long tm = (tl + tr) / 2;
  update(2 * i + 1, tl, tm, l, r);
  update(2 * i + 2, tm, tr, l, r);
  if (tl <= l) {
    if (r <= tr) {
      t[i].first = (t[i].first + f[r - l + 2] - f[2] + 1000000009) % 1000000009;
    } else {
      t[i].first =
          (t[i].first + f[tr - l + 2] - f[2] + 1000000009) % 1000000009;
    }
  } else {
    t[i].first =
        (t[i].first + f[r - l + 2] - f[tl - l + 2] + 1000000009) % 1000000009;
  }
}
long long get(long long i, long long tl, long long tr, long long l,
              long long r) {
  push(i, tl, tr);
  if (l <= tl && tr <= r) {
    return t[i].first;
  }
  if (r <= tl || tr <= l) {
    return 0;
  }
  long long tm = (tl + tr) / 2;
  return (get(2 * i + 1, tl, tm, l, r) + get(2 * i + 2, tm, tr, l, r)) %
         1000000009;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  build(0, 0, n);
  f[0] = 0;
  f[1] = 1;
  for (long long i = 2; i < 300000 + 10; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % 1000000009;
  }
  for (long long i = 0; i < m; i++) {
    std::cin >> request >> l >> r;
    if (request == 1) {
      update(0, 0, n, l - 1, r);
    } else {
      std::cout << get(0, 0, n, l - 1, r) << "\n";
    }
  }
  return 0;
}

### Prompt

Please formulate 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>
long long n, m, a[300000], request, l, r, f[300000 + 10];
std::pair<long long, std::pair<long long, long long>> t[4 * 300000];
void build(long long i, long long tl, long long tr) {
  if (tr - tl == 1) {
    t[i] = {a[tl], {0, 0}};
    return;
  }
  long long tm = (tl + tr) / 2;
  build(2 * i + 1, tl, tm);
  build(2 * i + 2, tm, tr);
  t[i] = {(t[2 * i + 1].first + t[2 * i + 2].first) % 1000000009, {0, 0}};
  return;
}
long long get_f(long long a, long long b, long long k) {
  if (k == 0) {
    return 0;
  }
  if (k == 1) {
    return a;
  }
  return ((a * f[k - 2]) % 1000000009 + (b * f[k - 1]) % 1000000009) %
         1000000009;
}
void push(long long i, long long tl, long long tr) {
  if (tr - tl == 1) {
    t[i].first = (t[i].first + t[i].second.first) % 1000000009;
    t[i].second = {0, 0};
    return;
  }
  long long tm = (tl + tr) / 2;
  t[2 * i + 1].second.first =
      (t[2 * i + 1].second.first + t[i].second.first) % 1000000009;
  t[2 * i + 1].second.second =
      (t[2 * i + 1].second.second + t[i].second.second) % 1000000009;
  t[2 * i + 2].second.first =
      (t[2 * i + 2].second.first +
       get_f(t[i].second.first, t[i].second.second, tm - tl + 1)) %
      1000000009;
  t[2 * i + 2].second.second =
      (t[2 * i + 2].second.second +
       get_f(t[i].second.first, t[i].second.second, tm - tl + 2)) %
      1000000009;
  t[i].first =
      (t[i].first + get_f(t[i].second.first, t[i].second.second, tr - tl + 2) -
       get_f(t[i].second.first, t[i].second.second, 2) + 1000000009) %
      1000000009;
  t[i].second = {0, 0};
  return;
}
void update(long long i, long long tl, long long tr, long long l, long long r) {
  if (l <= tl && tr <= r) {
    t[i].second.first =
        (t[i].second.first + get_f(1, 1, tl - l + 1)) % 1000000009;
    t[i].second.second =
        (t[i].second.second + get_f(1, 1, tl - l + 2)) % 1000000009;
    return;
  }
  if (r <= tl || tr <= l) {
    return;
  }
  long long tm = (tl + tr) / 2;
  update(2 * i + 1, tl, tm, l, r);
  update(2 * i + 2, tm, tr, l, r);
  if (tl <= l) {
    if (r <= tr) {
      t[i].first = (t[i].first + f[r - l + 2] - f[2] + 1000000009) % 1000000009;
    } else {
      t[i].first =
          (t[i].first + f[tr - l + 2] - f[2] + 1000000009) % 1000000009;
    }
  } else {
    t[i].first =
        (t[i].first + f[r - l + 2] - f[tl - l + 2] + 1000000009) % 1000000009;
  }
}
long long get(long long i, long long tl, long long tr, long long l,
              long long r) {
  push(i, tl, tr);
  if (l <= tl && tr <= r) {
    return t[i].first;
  }
  if (r <= tl || tr <= l) {
    return 0;
  }
  long long tm = (tl + tr) / 2;
  return (get(2 * i + 1, tl, tm, l, r) + get(2 * i + 2, tm, tr, l, r)) %
         1000000009;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  build(0, 0, n);
  f[0] = 0;
  f[1] = 1;
  for (long long i = 2; i < 300000 + 10; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % 1000000009;
  }
  for (long long i = 0; i < m; i++) {
    std::cin >> request >> l >> r;
    if (request == 1) {
      update(0, 0, n, l - 1, r);
    } else {
      std::cout << get(0, 0, n, l - 1, r) << "\n";
    }
  }
  return 0;
}

```