#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vb = vector<bool>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vvvpii = vector<vvpii>;
const long long mod = 1000000007;
template <int MOD>
struct ModInt {
  static const int Mod = MOD;
  unsigned x;
  ModInt() : x(0) {}
  ModInt(signed sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  ModInt(signed long long sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  int get() const { return (int)x; }
  ModInt &operator+=(ModInt that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(ModInt that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(ModInt that) {
    x = (unsigned long long)x * that.x % MOD;
    return *this;
  }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  ModInt inverse() const {
    signed a = x, b = MOD, u = 1, v = 0;
    while (b) {
      signed t = a / b;
      a -= t * b;
      std::swap(a, b);
      u -= t * v;
      std::swap(u, v);
    }
    if (u < 0) u += Mod;
    ModInt res;
    res.x = (unsigned)u;
    return res;
  }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  ModInt operator-() const {
    ModInt t;
    t.x = x == 0 ? 0 : Mod - x;
    return t;
  }
};
template <int MOD>
ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
  ModInt<MOD> r = 1;
  while (k) {
    if (k & 1) r *= a;
    a *= a;
    k >>= 1;
  }
  return r;
}
template <typename T, int N>
struct matrix_ {
  array<T, N * N> val;
  matrix_(vector<vector<T>> ini) {
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++) val[i * N + j] = ini[i][j];
  }
  matrix_(int d = 0) {
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++) val[i * N + j] = T((i == j) * d);
  }
  matrix_ operator+(const matrix_ &x) const {
    matrix_ ret;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++) {
        ret.val[i * N + j] = val[i * N + j] + x.val[i * N + j];
      }
    return ret;
  }
  matrix_ operator*(const matrix_ &x) const {
    matrix_ ret;
    for (int i = 0; i < N; i++)
      for (int k = 0; k < N; k++)
        for (int j = 0; j < N; j++) {
          ret.val[i * N + j] += val[i * N + k] * x.val[k * N + j];
        }
    return ret;
  }
  matrix_ operator^(long long p) const {
    matrix_ ret(1);
    matrix_ x = (*this);
    while (p) {
      if (p & 1) ret = ret * x;
      x = x * x;
      p >>= 1;
    }
    return ret;
  }
  T &at(int row, int col) { return val[row * N + col]; }
};
using Mat = matrix_<ModInt<mod>, 2>;
using V = Mat;
const Mat eye(1);
const Mat zero(0);
const Mat ini({{1, 1}, {1, 0}});
struct SegTreeLazy {
  struct Node {
    V dat;
    V lazy;
    bool flag;
    Node() : dat(eye), lazy(eye), flag(false) {}
  };
  const int N;
  vector<Node> seg;
  SegTreeLazy(int size) : N(p2(size)), seg(N * 2){};
  void update(int a, int b, const V &v) { update(a, b, v, 0, 0, N); }
  V query(int a, int b) { return query(a, b, 0, 0, N); }

 private:
  void push(int k, int l, int r) {
    if (seg[k].flag) {
      seg[k].dat = seg[k].dat * seg[k].lazy;
      if (r - l > 1) {
        seg[k * 2 + 1].lazy = seg[k * 2 + 1].lazy * seg[k].lazy;
        seg[k * 2 + 2].lazy = seg[k * 2 + 2].lazy * seg[k].lazy;
        seg[k * 2 + 1].flag = true;
        seg[k * 2 + 2].flag = true;
      }
      seg[k].lazy = eye;
      seg[k].flag = false;
    }
  }
  void update(int a, int b, const V &v, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      seg[k].lazy = v;
      seg[k].flag = true;
      push(k, l, r);
    } else {
      update(a, b, v, k * 2 + 1, l, (l + r) / 2);
      update(a, b, v, k * 2 + 2, (l + r) / 2, r);
      seg[k].dat = seg[k * 2 + 1].dat + seg[k * 2 + 2].dat;
    }
  }
  V query(int a, int b, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return zero;
    if (a <= l && r <= b) return seg[k].dat;
    V x = query(a, b, k * 2 + 1, l, (l + r) / 2);
    V y = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return x + y;
  }
  static int p2(int n, int m = 1) { return m >= n ? m : p2(n, m * 2); }
};
void Main() {
  int N, Q;
  scanf("%d%d", &N, &Q);
  SegTreeLazy seg(N + 1);
  for (int i = int(0); i < int(N); ++i) {
    int a;
    scanf("%d", &a);
    auto p = ini ^ a;
    seg.update(i, i + 1, p);
  }
  while (Q--) {
    int t, l, r, x;
    scanf("%d%d%d", &t, &l, &r);
    l--;
    r--;
    if (t == 1) {
      scanf("%d", &x);
      auto p = ini ^ x;
      seg.update(l, r + 1, p);
    } else {
      auto ret = seg.query(l, r + 1);
      (void)printf("%d\n", ret.at(1, 0).get());
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  Main();
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

Sasha has an array of integers a1, a2, ..., an. You have to perform m queries. There might be queries of two types:

  1. 1 l r x — increase all integers on the segment from l to r by values x; 
  2. 2 l r — find <image>, where f(x) is the x-th Fibonacci number. As this number may be large, you only have to find it modulo 109 + 7. 



In this problem we define Fibonacci numbers as follows: f(1) = 1, f(2) = 1, f(x) = f(x - 1) + f(x - 2) for all x > 2.

Sasha is a very talented boy and he managed to perform all queries in five seconds. Will you be able to write the program that performs as well as Sasha?

Input

The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ 100 000) — the number of elements in the array and the number of queries respectively.

The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109).

Then follow m lines with queries descriptions. Each of them contains integers tpi, li, ri and may be xi (1 ≤ tpi ≤ 2, 1 ≤ li ≤ ri ≤ n, 1 ≤ xi ≤ 109). Here tpi = 1 corresponds to the queries of the first type and tpi corresponds to the queries of the second type.

It's guaranteed that the input will contains at least one query of the second type.

Output

For each query of the second type print the answer modulo 109 + 7.

Examples

Input

5 4
1 1 2 1 1
2 1 5
1 2 4 2
2 2 4
2 1 5


Output

5
7
9

Note

Initially, array a is equal to 1, 1, 2, 1, 1.

The answer for the first query of the second type is f(1) + f(1) + f(2) + f(1) + f(1) = 1 + 1 + 1 + 1 + 1 = 5. 

After the query 1 2 4 2 array a is equal to 1, 3, 4, 3, 1.

The answer for the second query of the second type is f(3) + f(4) + f(3) = 2 + 3 + 2 = 7.

The answer for the third query of the second type is f(1) + f(3) + f(4) + f(3) + f(1) = 1 + 2 + 3 + 2 + 1 = 9.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vb = vector<bool>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vvvpii = vector<vvpii>;
const long long mod = 1000000007;
template <int MOD>
struct ModInt {
  static const int Mod = MOD;
  unsigned x;
  ModInt() : x(0) {}
  ModInt(signed sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  ModInt(signed long long sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  int get() const { return (int)x; }
  ModInt &operator+=(ModInt that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(ModInt that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(ModInt that) {
    x = (unsigned long long)x * that.x % MOD;
    return *this;
  }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  ModInt inverse() const {
    signed a = x, b = MOD, u = 1, v = 0;
    while (b) {
      signed t = a / b;
      a -= t * b;
      std::swap(a, b);
      u -= t * v;
      std::swap(u, v);
    }
    if (u < 0) u += Mod;
    ModInt res;
    res.x = (unsigned)u;
    return res;
  }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  ModInt operator-() const {
    ModInt t;
    t.x = x == 0 ? 0 : Mod - x;
    return t;
  }
};
template <int MOD>
ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
  ModInt<MOD> r = 1;
  while (k) {
    if (k & 1) r *= a;
    a *= a;
    k >>= 1;
  }
  return r;
}
template <typename T, int N>
struct matrix_ {
  array<T, N * N> val;
  matrix_(vector<vector<T>> ini) {
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++) val[i * N + j] = ini[i][j];
  }
  matrix_(int d = 0) {
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++) val[i * N + j] = T((i == j) * d);
  }
  matrix_ operator+(const matrix_ &x) const {
    matrix_ ret;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++) {
        ret.val[i * N + j] = val[i * N + j] + x.val[i * N + j];
      }
    return ret;
  }
  matrix_ operator*(const matrix_ &x) const {
    matrix_ ret;
    for (int i = 0; i < N; i++)
      for (int k = 0; k < N; k++)
        for (int j = 0; j < N; j++) {
          ret.val[i * N + j] += val[i * N + k] * x.val[k * N + j];
        }
    return ret;
  }
  matrix_ operator^(long long p) const {
    matrix_ ret(1);
    matrix_ x = (*this);
    while (p) {
      if (p & 1) ret = ret * x;
      x = x * x;
      p >>= 1;
    }
    return ret;
  }
  T &at(int row, int col) { return val[row * N + col]; }
};
using Mat = matrix_<ModInt<mod>, 2>;
using V = Mat;
const Mat eye(1);
const Mat zero(0);
const Mat ini({{1, 1}, {1, 0}});
struct SegTreeLazy {
  struct Node {
    V dat;
    V lazy;
    bool flag;
    Node() : dat(eye), lazy(eye), flag(false) {}
  };
  const int N;
  vector<Node> seg;
  SegTreeLazy(int size) : N(p2(size)), seg(N * 2){};
  void update(int a, int b, const V &v) { update(a, b, v, 0, 0, N); }
  V query(int a, int b) { return query(a, b, 0, 0, N); }

 private:
  void push(int k, int l, int r) {
    if (seg[k].flag) {
      seg[k].dat = seg[k].dat * seg[k].lazy;
      if (r - l > 1) {
        seg[k * 2 + 1].lazy = seg[k * 2 + 1].lazy * seg[k].lazy;
        seg[k * 2 + 2].lazy = seg[k * 2 + 2].lazy * seg[k].lazy;
        seg[k * 2 + 1].flag = true;
        seg[k * 2 + 2].flag = true;
      }
      seg[k].lazy = eye;
      seg[k].flag = false;
    }
  }
  void update(int a, int b, const V &v, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      seg[k].lazy = v;
      seg[k].flag = true;
      push(k, l, r);
    } else {
      update(a, b, v, k * 2 + 1, l, (l + r) / 2);
      update(a, b, v, k * 2 + 2, (l + r) / 2, r);
      seg[k].dat = seg[k * 2 + 1].dat + seg[k * 2 + 2].dat;
    }
  }
  V query(int a, int b, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return zero;
    if (a <= l && r <= b) return seg[k].dat;
    V x = query(a, b, k * 2 + 1, l, (l + r) / 2);
    V y = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return x + y;
  }
  static int p2(int n, int m = 1) { return m >= n ? m : p2(n, m * 2); }
};
void Main() {
  int N, Q;
  scanf("%d%d", &N, &Q);
  SegTreeLazy seg(N + 1);
  for (int i = int(0); i < int(N); ++i) {
    int a;
    scanf("%d", &a);
    auto p = ini ^ a;
    seg.update(i, i + 1, p);
  }
  while (Q--) {
    int t, l, r, x;
    scanf("%d%d%d", &t, &l, &r);
    l--;
    r--;
    if (t == 1) {
      scanf("%d", &x);
      auto p = ini ^ x;
      seg.update(l, r + 1, p);
    } else {
      auto ret = seg.query(l, r + 1);
      (void)printf("%d\n", ret.at(1, 0).get());
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  Main();
  return 0;
}

```