#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template <class T>
inline bool ckmin(T& a, T b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
inline bool ckmax(T& a, T b) {
  return b > a ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const char nl = '\n';
const int mxN = 2e5 + 10;
const int MOD = 1e9 + 7;
const long long infLL = 1e18;
int fact[mxN];
int add(int x, int y) {
  x += y;
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
  return x;
}
void ad(int& x, int y) { x = add(x, y); }
int sub(int x, int y) {
  x -= y;
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
  return x;
}
void sb(int& x, int y) { x = sub(x, y); }
int mul(int x, int y) { return ((int64_t)x * (int64_t)y) % MOD; }
void ml(int& x, int y) { x = mul(x, y); }
int binpow(int x, int y) {
  int z = 1;
  while (y > 0) {
    if (y % 2 == 1) z = mul(z, x);
    x = mul(x, x);
    y /= 2;
  }
  return z;
}
int inv(int x) { return binpow(x, MOD - 2); }
int divide(int x, int y) { return mul(x, inv(y)); }
void precalc() {
  fact[0] = 1;
  for (int i = 1; i < mxN; i++) fact[i] = mul(i, fact[i - 1]);
}
int choose(int n, int k) {
  if (k > n) return 0;
  return divide(fact[n], mul(fact[n - k], fact[k]));
}
template <class T, int N>
struct Mat {
  array<array<T, N>, N> d{};
  Mat operator*(const Mat& m) const {
    Mat a;
    for (int i = (0); i < (N); i++)
      for (int j = (0); j < (N); j++)
        for (int k = (0); k < (N); k++) {
          ad(a.d[i][j], mul(d[i][k], m.d[k][j]));
        }
    return a;
  };
  Mat operator+(const Mat& m) const {
    Mat res;
    for (int i = (0); i < (N); i++) {
      for (int j = (0); j < (N); j++) {
        res.d[i][j] = add(m.d[i][j], d[i][j]);
      }
    }
    return res;
  }
  bool operator==(const Mat& m) const {
    for (int i = (0); i < (N); i++) {
      for (int j = (0); j < (N); j++) {
        if (m.d[i][j] != d[i][j]) return 0;
      }
    }
    return 1;
  }
  vector<T> operator*(const vector<T>& vec) {
    vector<T> ret(N);
    for (int i = (0); i < (N); i++)
      for (int j = (0); j < (N); j++) ad(ret[i], mul(d[i][j], vec[j]));
    return ret;
  };
  Mat operator^(ll p) {
    Mat a, b(*this);
    for (int i = (0); i < (N); i++) a.d[i][i] = 1;
    while (p) {
      if (p & 1) a = a * b;
      b = b * b;
      p /= 2;
    }
    return a;
  };
};
using node = vector<int>;
struct lazy {
  int size;
  vector<Mat<int, 2>> operations;
  vector<node> vals;
  const node START_VAL = {1, 1};
  const node NEUTRAL_ELEMENT = {0, 0};
  Mat<int, 2> M;
  Mat<int, 2> query_op(Mat<int, 2> a, Mat<int, 2> b, int len) {
    if (a == M) {
      return b;
    }
    if (b == M) {
      return a;
    }
    return b * a;
  }
  vi query_op(vi a, Mat<int, 2> b, int len) {
    if (b == M) {
      return a;
    }
    return b * a;
  }
  node calc_op(node a, node b) {
    node res(2);
    for (int i = (0); i < (2); i++) res[i] = add(a[i], b[i]);
    return res;
  }
  template <class T>
  void apply_mod_op(T& a, Mat<int, 2> b, int c) {
    a = query_op(a, b, c);
  }
  void propogate(int x, int lx, int rx) {
    if (rx - lx == 1) return;
    int m = (lx + rx) / 2;
    apply_mod_op(operations[2 * x + 1], operations[x], 1);
    apply_mod_op(vals[2 * x + 1], operations[x], m - lx);
    apply_mod_op(operations[2 * x + 2], operations[x], 1);
    apply_mod_op(vals[2 * x + 2], operations[x], rx - m);
    operations[x].d[0][0] = 0;
    operations[x].d[0][1] = 0;
    operations[x].d[1][0] = 69;
    operations[x].d[1][1] = 69;
  }
  void build(int x, int lx, int rx) {
    if (rx == lx + 1) {
      vals[x] = START_VAL;
      return;
    }
    int m = (lx + rx) / 2;
    build(2 * x + 1, lx, m);
    build(2 * x + 2, m, rx);
    vals[x] = calc_op(vals[x * 2 + 1], vals[x * 2 + 2]);
  }
  void init(int n) {
    size = 1;
    while (size < n) size *= 2;
    M.d[0][0] = 0;
    M.d[0][1] = 0;
    M.d[1][0] = 69;
    M.d[1][1] = 69;
    operations.assign(2 * size, M);
    vals.assign(2 * size, {1, 1});
    build(0, 0, size);
  }
  void update(int l, int r, Mat<int, 2> v, int x, int lx, int rx) {
    propogate(x, lx, rx);
    if (lx >= r || l >= rx) return;
    if (lx >= l && rx <= r) {
      apply_mod_op(operations[x], v, 1);
      apply_mod_op(vals[x], v, rx - lx);
      return;
    }
    int m = (lx + rx) / 2;
    update(l, r, v, 2 * x + 1, lx, m);
    update(l, r, v, 2 * x + 2, m, rx);
    vals[x] = calc_op(vals[x * 2 + 1], vals[x * 2 + 2]);
  }
  void update(int l, int r, Mat<int, 2> v) { update(l, r, v, 0, 0, size); }
  node query(int l, int r, int x, int lx, int rx) {
    propogate(x, lx, rx);
    if (lx >= r || l >= rx) return NEUTRAL_ELEMENT;
    if (lx >= l && rx <= r) {
      return vals[x];
    }
    int m = (lx + rx) / 2;
    node m1 = query(l, r, 2 * x + 1, lx, m);
    node m2 = query(l, r, 2 * x + 2, m, rx);
    return calc_op(m1, m2);
  }
  node query(int l, int r) { return query(l, r, 0, 0, size); }
} st;
int n, m;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  Mat<int, 2> Fib;
  Fib.d[0][0] = 0;
  Fib.d[0][1] = 1;
  Fib.d[1][0] = 1;
  Fib.d[1][1] = 1;
  st.init(n);
  for (int i = (0); i < (n); i++) {
    int x;
    cin >> x;
    if (x == 1) {
    } else {
      st.update(i, i + 1, Fib ^ (x - 1));
    }
  }
  while (m--) {
    int type;
    int l, r;
    cin >> type >> l >> r;
    l--;
    r--;
    if (type == 1) {
      int amt;
      cin >> amt;
      st.update(l, r + 1, Fib ^ amt);
    } else {
      cout << st.query(l, r + 1)[0] << nl;
    }
  }
  return 0;
}

### Prompt

Please provide a CPP coded solution to the problem described below:

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 vi = vector<int>;
using vl = vector<long long>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template <class T>
inline bool ckmin(T& a, T b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
inline bool ckmax(T& a, T b) {
  return b > a ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const char nl = '\n';
const int mxN = 2e5 + 10;
const int MOD = 1e9 + 7;
const long long infLL = 1e18;
int fact[mxN];
int add(int x, int y) {
  x += y;
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
  return x;
}
void ad(int& x, int y) { x = add(x, y); }
int sub(int x, int y) {
  x -= y;
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
  return x;
}
void sb(int& x, int y) { x = sub(x, y); }
int mul(int x, int y) { return ((int64_t)x * (int64_t)y) % MOD; }
void ml(int& x, int y) { x = mul(x, y); }
int binpow(int x, int y) {
  int z = 1;
  while (y > 0) {
    if (y % 2 == 1) z = mul(z, x);
    x = mul(x, x);
    y /= 2;
  }
  return z;
}
int inv(int x) { return binpow(x, MOD - 2); }
int divide(int x, int y) { return mul(x, inv(y)); }
void precalc() {
  fact[0] = 1;
  for (int i = 1; i < mxN; i++) fact[i] = mul(i, fact[i - 1]);
}
int choose(int n, int k) {
  if (k > n) return 0;
  return divide(fact[n], mul(fact[n - k], fact[k]));
}
template <class T, int N>
struct Mat {
  array<array<T, N>, N> d{};
  Mat operator*(const Mat& m) const {
    Mat a;
    for (int i = (0); i < (N); i++)
      for (int j = (0); j < (N); j++)
        for (int k = (0); k < (N); k++) {
          ad(a.d[i][j], mul(d[i][k], m.d[k][j]));
        }
    return a;
  };
  Mat operator+(const Mat& m) const {
    Mat res;
    for (int i = (0); i < (N); i++) {
      for (int j = (0); j < (N); j++) {
        res.d[i][j] = add(m.d[i][j], d[i][j]);
      }
    }
    return res;
  }
  bool operator==(const Mat& m) const {
    for (int i = (0); i < (N); i++) {
      for (int j = (0); j < (N); j++) {
        if (m.d[i][j] != d[i][j]) return 0;
      }
    }
    return 1;
  }
  vector<T> operator*(const vector<T>& vec) {
    vector<T> ret(N);
    for (int i = (0); i < (N); i++)
      for (int j = (0); j < (N); j++) ad(ret[i], mul(d[i][j], vec[j]));
    return ret;
  };
  Mat operator^(ll p) {
    Mat a, b(*this);
    for (int i = (0); i < (N); i++) a.d[i][i] = 1;
    while (p) {
      if (p & 1) a = a * b;
      b = b * b;
      p /= 2;
    }
    return a;
  };
};
using node = vector<int>;
struct lazy {
  int size;
  vector<Mat<int, 2>> operations;
  vector<node> vals;
  const node START_VAL = {1, 1};
  const node NEUTRAL_ELEMENT = {0, 0};
  Mat<int, 2> M;
  Mat<int, 2> query_op(Mat<int, 2> a, Mat<int, 2> b, int len) {
    if (a == M) {
      return b;
    }
    if (b == M) {
      return a;
    }
    return b * a;
  }
  vi query_op(vi a, Mat<int, 2> b, int len) {
    if (b == M) {
      return a;
    }
    return b * a;
  }
  node calc_op(node a, node b) {
    node res(2);
    for (int i = (0); i < (2); i++) res[i] = add(a[i], b[i]);
    return res;
  }
  template <class T>
  void apply_mod_op(T& a, Mat<int, 2> b, int c) {
    a = query_op(a, b, c);
  }
  void propogate(int x, int lx, int rx) {
    if (rx - lx == 1) return;
    int m = (lx + rx) / 2;
    apply_mod_op(operations[2 * x + 1], operations[x], 1);
    apply_mod_op(vals[2 * x + 1], operations[x], m - lx);
    apply_mod_op(operations[2 * x + 2], operations[x], 1);
    apply_mod_op(vals[2 * x + 2], operations[x], rx - m);
    operations[x].d[0][0] = 0;
    operations[x].d[0][1] = 0;
    operations[x].d[1][0] = 69;
    operations[x].d[1][1] = 69;
  }
  void build(int x, int lx, int rx) {
    if (rx == lx + 1) {
      vals[x] = START_VAL;
      return;
    }
    int m = (lx + rx) / 2;
    build(2 * x + 1, lx, m);
    build(2 * x + 2, m, rx);
    vals[x] = calc_op(vals[x * 2 + 1], vals[x * 2 + 2]);
  }
  void init(int n) {
    size = 1;
    while (size < n) size *= 2;
    M.d[0][0] = 0;
    M.d[0][1] = 0;
    M.d[1][0] = 69;
    M.d[1][1] = 69;
    operations.assign(2 * size, M);
    vals.assign(2 * size, {1, 1});
    build(0, 0, size);
  }
  void update(int l, int r, Mat<int, 2> v, int x, int lx, int rx) {
    propogate(x, lx, rx);
    if (lx >= r || l >= rx) return;
    if (lx >= l && rx <= r) {
      apply_mod_op(operations[x], v, 1);
      apply_mod_op(vals[x], v, rx - lx);
      return;
    }
    int m = (lx + rx) / 2;
    update(l, r, v, 2 * x + 1, lx, m);
    update(l, r, v, 2 * x + 2, m, rx);
    vals[x] = calc_op(vals[x * 2 + 1], vals[x * 2 + 2]);
  }
  void update(int l, int r, Mat<int, 2> v) { update(l, r, v, 0, 0, size); }
  node query(int l, int r, int x, int lx, int rx) {
    propogate(x, lx, rx);
    if (lx >= r || l >= rx) return NEUTRAL_ELEMENT;
    if (lx >= l && rx <= r) {
      return vals[x];
    }
    int m = (lx + rx) / 2;
    node m1 = query(l, r, 2 * x + 1, lx, m);
    node m2 = query(l, r, 2 * x + 2, m, rx);
    return calc_op(m1, m2);
  }
  node query(int l, int r) { return query(l, r, 0, 0, size); }
} st;
int n, m;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  Mat<int, 2> Fib;
  Fib.d[0][0] = 0;
  Fib.d[0][1] = 1;
  Fib.d[1][0] = 1;
  Fib.d[1][1] = 1;
  st.init(n);
  for (int i = (0); i < (n); i++) {
    int x;
    cin >> x;
    if (x == 1) {
    } else {
      st.update(i, i + 1, Fib ^ (x - 1));
    }
  }
  while (m--) {
    int type;
    int l, r;
    cin >> type >> l >> r;
    l--;
    r--;
    if (type == 1) {
      int amt;
      cin >> amt;
      st.update(l, r + 1, Fib ^ amt);
    } else {
      cout << st.query(l, r + 1)[0] << nl;
    }
  }
  return 0;
}

```