#include <bits/stdc++.h>
using namespace std;
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;
  }
};
int n;
int m;
struct matrix_A {
  ModInt<1000000007> a[2][2];
  matrix_A() { a[0][0] = a[0][1] = a[1][0] = a[1][1] = 0; }
};
struct matrix_B {
  ModInt<1000000007> a[2];
  matrix_B() { a[0] = a[1] = 0; }
};
namespace math {
namespace fibonacci {
matrix_A mat;
}
}  // namespace math
struct st {
  matrix_A lazy;
  matrix_B sum;
  st() {
    lazy.a[0][0] = lazy.a[1][1] = 1;
    lazy.a[0][1] = lazy.a[1][0] = 0;
  }
  void done() {
    matrix_B nex;
    nex.a[0] = lazy.a[0][0] * sum.a[0] + lazy.a[0][1] * sum.a[1];
    nex.a[1] = lazy.a[1][0] * sum.a[0] + lazy.a[1][1] * sum.a[1];
    sum = nex;
  }
};
st seg[100002 * 4];
matrix_A mult(matrix_A &a, matrix_A &b) {
  matrix_A r;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        r.a[i][j] += a.a[i][k] * b.a[k][j];
      }
    }
  }
  return r;
}
matrix_A ppow(matrix_A a, int n) {
  matrix_A b = a;
  if (n == 1LL) {
    return b;
  }
  n--;
  while (n) {
    if ((n & 1LL)) {
      b = mult(b, a);
    }
    a = mult(a, a);
    n >>= 1LL;
  }
  return b;
}
void update(int b) {
  seg[b].done();
  if (b * 2 + 2 < 100002 * 4) {
    seg[(b << 1) + 1].lazy = mult(seg[(b << 1) + 1].lazy, seg[b].lazy);
    seg[(b << 1) + 2].lazy = mult(seg[(b << 1) + 2].lazy, seg[b].lazy);
  }
  seg[b].lazy.a[0][0] = seg[b].lazy.a[1][1] = 1;
  seg[b].lazy.a[0][1] = seg[b].lazy.a[1][0] = 0;
}
void add(matrix_A &l, matrix_A &r) {
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      l.a[i][j] += r.a[i][j];
    }
  }
}
inline void add(int b, int l, int r, int ll, int rr, matrix_A &x) {
  update(b);
  if (r <= ll || rr <= l) {
    return;
  }
  if (ll <= l && r <= rr) {
    seg[b].lazy = mult(seg[b].lazy, x);
    update(b);
    return;
  }
  add((b << 1) + 1, l, (l + r) >> 1, ll, rr, x);
  add((b << 1) + 2, (l + r) >> 1, r, ll, rr, x);
  seg[b].sum.a[0] = seg[(b << 1) + 1].sum.a[0] + seg[(b << 1) + 2].sum.a[0];
  seg[b].sum.a[1] = seg[(b << 1) + 1].sum.a[1] + seg[(b << 1) + 2].sum.a[1];
}
matrix_B add(matrix_B a, matrix_B b) {
  matrix_B r = a;
  r.a[0] += b.a[0];
  r.a[1] += b.a[1];
  return r;
}
inline matrix_B query(int b, int l, int r, int ll, int rr) {
  update(b);
  if (r <= ll || rr <= l) {
    return matrix_B();
  }
  if (ll <= l && r <= rr) {
    return seg[b].sum;
  }
  return add(query((b << 1) + 1, l, (l + r) >> 1, ll, rr),
             query((b << 1) + 2, (l + r) >> 1, r, ll, rr));
}
inline void init(int b, int l, int r) {
  seg[b].sum.a[0] = 0;
  seg[b].sum.a[1] = r - l;
  if (l + 1 == r) return;
  init(b * 2 + 1, l, (l + r) >> 1);
  init(b * 2 + 2, (l + r) >> 1, r);
}
matrix_A get(int p) {
  math::fibonacci::mat.a[0][0] = 0;
  math::fibonacci::mat.a[0][1] = 1LL;
  math::fibonacci::mat.a[1][0] = 1LL;
  math::fibonacci::mat.a[1][1] = 1LL;
  math::fibonacci::mat = ppow(math::fibonacci::mat, p);
  matrix_A AA;
  AA.a[0][0] = math::fibonacci::mat.a[0][0];
  AA.a[0][1] = math::fibonacci::mat.a[0][1];
  AA.a[1][0] = math::fibonacci::mat.a[1][0];
  AA.a[1][1] = math::fibonacci::mat.a[1][1];
  return AA;
}
ModInt<1000000007> P[100002];
int main() {
  cin >> n >> m;
  init(0, 0, n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    P[i] = a;
    if (a > 1) {
      auto f = get(a - 1);
      add(0, 0, n, i, i + 1, f);
    }
  }
  while (m--) {
    int ty;
    scanf("%d", &ty);
    if (ty == 1) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      l--;
      r--;
      auto f = get(x);
      add(0, 0, n, l, r + 1, f);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      l--;
      r--;
      ModInt<1000000007> ans = query(0, 0, n, l, r + 1).a[1];
      int c = ans.get();
      printf("%d\n", c);
    }
  }
  return 0;
}

### Prompt

Your task is to create a Cpp solution to 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;
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;
  }
};
int n;
int m;
struct matrix_A {
  ModInt<1000000007> a[2][2];
  matrix_A() { a[0][0] = a[0][1] = a[1][0] = a[1][1] = 0; }
};
struct matrix_B {
  ModInt<1000000007> a[2];
  matrix_B() { a[0] = a[1] = 0; }
};
namespace math {
namespace fibonacci {
matrix_A mat;
}
}  // namespace math
struct st {
  matrix_A lazy;
  matrix_B sum;
  st() {
    lazy.a[0][0] = lazy.a[1][1] = 1;
    lazy.a[0][1] = lazy.a[1][0] = 0;
  }
  void done() {
    matrix_B nex;
    nex.a[0] = lazy.a[0][0] * sum.a[0] + lazy.a[0][1] * sum.a[1];
    nex.a[1] = lazy.a[1][0] * sum.a[0] + lazy.a[1][1] * sum.a[1];
    sum = nex;
  }
};
st seg[100002 * 4];
matrix_A mult(matrix_A &a, matrix_A &b) {
  matrix_A r;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        r.a[i][j] += a.a[i][k] * b.a[k][j];
      }
    }
  }
  return r;
}
matrix_A ppow(matrix_A a, int n) {
  matrix_A b = a;
  if (n == 1LL) {
    return b;
  }
  n--;
  while (n) {
    if ((n & 1LL)) {
      b = mult(b, a);
    }
    a = mult(a, a);
    n >>= 1LL;
  }
  return b;
}
void update(int b) {
  seg[b].done();
  if (b * 2 + 2 < 100002 * 4) {
    seg[(b << 1) + 1].lazy = mult(seg[(b << 1) + 1].lazy, seg[b].lazy);
    seg[(b << 1) + 2].lazy = mult(seg[(b << 1) + 2].lazy, seg[b].lazy);
  }
  seg[b].lazy.a[0][0] = seg[b].lazy.a[1][1] = 1;
  seg[b].lazy.a[0][1] = seg[b].lazy.a[1][0] = 0;
}
void add(matrix_A &l, matrix_A &r) {
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      l.a[i][j] += r.a[i][j];
    }
  }
}
inline void add(int b, int l, int r, int ll, int rr, matrix_A &x) {
  update(b);
  if (r <= ll || rr <= l) {
    return;
  }
  if (ll <= l && r <= rr) {
    seg[b].lazy = mult(seg[b].lazy, x);
    update(b);
    return;
  }
  add((b << 1) + 1, l, (l + r) >> 1, ll, rr, x);
  add((b << 1) + 2, (l + r) >> 1, r, ll, rr, x);
  seg[b].sum.a[0] = seg[(b << 1) + 1].sum.a[0] + seg[(b << 1) + 2].sum.a[0];
  seg[b].sum.a[1] = seg[(b << 1) + 1].sum.a[1] + seg[(b << 1) + 2].sum.a[1];
}
matrix_B add(matrix_B a, matrix_B b) {
  matrix_B r = a;
  r.a[0] += b.a[0];
  r.a[1] += b.a[1];
  return r;
}
inline matrix_B query(int b, int l, int r, int ll, int rr) {
  update(b);
  if (r <= ll || rr <= l) {
    return matrix_B();
  }
  if (ll <= l && r <= rr) {
    return seg[b].sum;
  }
  return add(query((b << 1) + 1, l, (l + r) >> 1, ll, rr),
             query((b << 1) + 2, (l + r) >> 1, r, ll, rr));
}
inline void init(int b, int l, int r) {
  seg[b].sum.a[0] = 0;
  seg[b].sum.a[1] = r - l;
  if (l + 1 == r) return;
  init(b * 2 + 1, l, (l + r) >> 1);
  init(b * 2 + 2, (l + r) >> 1, r);
}
matrix_A get(int p) {
  math::fibonacci::mat.a[0][0] = 0;
  math::fibonacci::mat.a[0][1] = 1LL;
  math::fibonacci::mat.a[1][0] = 1LL;
  math::fibonacci::mat.a[1][1] = 1LL;
  math::fibonacci::mat = ppow(math::fibonacci::mat, p);
  matrix_A AA;
  AA.a[0][0] = math::fibonacci::mat.a[0][0];
  AA.a[0][1] = math::fibonacci::mat.a[0][1];
  AA.a[1][0] = math::fibonacci::mat.a[1][0];
  AA.a[1][1] = math::fibonacci::mat.a[1][1];
  return AA;
}
ModInt<1000000007> P[100002];
int main() {
  cin >> n >> m;
  init(0, 0, n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    P[i] = a;
    if (a > 1) {
      auto f = get(a - 1);
      add(0, 0, n, i, i + 1, f);
    }
  }
  while (m--) {
    int ty;
    scanf("%d", &ty);
    if (ty == 1) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      l--;
      r--;
      auto f = get(x);
      add(0, 0, n, l, r + 1, f);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      l--;
      r--;
      ModInt<1000000007> ans = query(0, 0, n, l, r + 1).a[1];
      int c = ans.get();
      printf("%d\n", c);
    }
  }
  return 0;
}

```