#include <bits/stdc++.h>
using namespace std;
typedef struct node {
  int a, w;
  int nxt;
} ND;
int n, m, tot;
const int p = 1000000007;
long long fact[20];
long long qpow(long long a, long long b, long long modp) {
  long long ans;
  for (ans = 1; b; b >>= 1, a = a * a % modp)
    if (b & 1) ans = ans * a % modp;
  return ans;
}
long long gcd(long long x, long long y) {
  while (y) {
    long long r = x % y;
    x = y;
    y = r;
  }
  return x;
}
void extgcd(long long a, long long b, long long& x, long long& y) {
  if (b != 0) {
    extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
}
long long mod_inv(long long a, long long modp) {
  long long x, y;
  extgcd(a, modp, x, y);
  return (modp + x % modp) % modp;
}
long long mod_fact(long long n, long long p, long long& e) {
  e = 0;
  if (n == 0) return 1;
  long long res = mod_fact(n / p, p, e);
  e += n / p;
  if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
  return res * fact[n % p] % p;
}
long long lucas(long long n, long long k) {
  if (n < 0 || k < 0 || n < k) return 0;
  long long e1, e2, e3;
  long long a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2),
            a3 = mod_fact(n - k, p, e3);
  if (e1 > e2 + e3) return 0;
  return a1 * mod_inv(a2 * a3 % p, p) % p;
}
long long crt(long long a1, long long m1, long long a2, long long m2) {
  long long g = gcd(m1, m2);
  long long k = a1 % g;
  if (k != a2 % g) return -1;
  m1 /= g, m2 /= g;
  a1 /= g, a2 /= g;
  return ((a1 + m1 - a2 % m1) % m1 * mod_inv(m2 % m1, m1) % m1 * m2 + a2) %
             (m1 * m2) * g +
         k;
}
struct fib {
  long long r[2][2];
  friend fib operator*(fib& x, fib& y) {
    fib res;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) {
        res.r[i][j] = 0;
        for (int k = 0; k < 2; ++k)
          res.r[i][j] += x.r[i][k] * y.r[k][j] % 1000000007;
        res.r[i][j] %= 1000000007;
      }
    return res;
  }
  friend fib operator+(fib& x, fib& y) {
    fib res;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) {
        res.r[i][j] = x.r[i][j] + y.r[i][j];
        res.r[i][j] %= 1000000007;
      }
    return res;
  }
  friend bool operator==(fib& x, fib& y) {
    return (x.r[0][0] == y.r[0][0] && x.r[0][1] == y.r[0][1] &&
            x.r[1][0] == y.r[1][0] && x.r[1][1] == y.r[1][1]);
  }
};
fib tr[150000 * 3];
fib ts[150000 * 3];
fib I, e;
fib mpow(fib x, int y) {
  fib res = e, b = x;
  while (y) {
    if (y & 1) res = res * b;
    b = b * b;
    y >>= 1;
  }
  return res;
}
void addT(int d, int l, int r, int x, int y, fib& c) {
  if (x < l || y > r || l > r || x > y) return;
  if (l == x && y == r) {
    tr[d] = tr[d] * c;
    if (l == r)
      ts[d] = tr[d];
    else
      ts[d] = ts[d] * c;
    return;
  }
  int o = l + r >> 1, ll = d << 1, rr = ll + 1;
  if (!(tr[d] == e)) {
    tr[ll] = tr[ll] * tr[d];
    ts[ll] = ts[ll] * tr[d];
    tr[rr] = tr[rr] * tr[d];
    ts[rr] = ts[rr] * tr[d];
    tr[d] = e;
  }
  if (y <= o)
    addT(ll, l, o, x, y, c);
  else if (x > o)
    addT(rr, o + 1, r, x, y, c);
  else
    addT(ll, l, o, x, o, c), addT(rr, o + 1, r, o + 1, y, c);
  ts[d] = ts[ll] + ts[rr];
}
fib calc(int d, int l, int r, int x, int y) {
  if (x < l || y > r || l > r || x > y) return e;
  if (l == x && y == r) {
    return ts[d];
  }
  int o = l + r >> 1, ll = d << 1, rr = ll + 1;
  if (!(tr[d] == e)) {
    tr[ll] = tr[ll] * tr[d];
    ts[ll] = ts[ll] * tr[d];
    tr[rr] = tr[rr] * tr[d];
    ts[rr] = ts[rr] * tr[d];
    tr[d] = e;
  }
  fib tmp, t1, t2;
  if (y <= o)
    tmp = calc(ll, l, o, x, y);
  else if (x > o)
    tmp = calc(rr, o + 1, r, x, y);
  else {
    t1 = calc(ll, l, o, x, o);
    t2 = calc(rr, o + 1, r, o + 1, y);
    tmp = t1 + t2;
  }
  ts[d] = ts[ll] + ts[rr];
  return tmp;
}
int main() {
  I.r[0][0] = 1;
  I.r[0][1] = 1;
  I.r[1][0] = 1;
  I.r[1][1] = 0;
  e.r[0][0] = 1;
  e.r[0][1] = 0;
  e.r[1][0] = 0;
  e.r[1][1] = 1;
  int T = 1;
  for (int cT = 1; cT <= T; ++cT) {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n * 4; ++i) {
      tr[i].r[0][0] = tr[i].r[1][1] = 1;
      tr[i].r[0][1] = tr[i].r[1][0] = 0;
    }
    for (int i = 1; i <= n; ++i) {
      int k;
      scanf("%d", &k);
      fib xx = mpow(I, k + 1);
      addT(1, 1, n, i, i, xx);
    }
    for (int i = 0; i < m; ++i) {
      int op, l, r;
      scanf("%d%d%d", &op, &l, &r);
      if (op == 1) {
        int k;
        scanf("%d", &k);
        fib xx = mpow(I, k);
        addT(1, 1, n, l, r, xx);
      }
      if (op == 2) {
        long long ans = calc(1, 1, n, l, r).r[1][1];
        printf("%I64d\n", ans);
      }
    }
  }
  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;
typedef struct node {
  int a, w;
  int nxt;
} ND;
int n, m, tot;
const int p = 1000000007;
long long fact[20];
long long qpow(long long a, long long b, long long modp) {
  long long ans;
  for (ans = 1; b; b >>= 1, a = a * a % modp)
    if (b & 1) ans = ans * a % modp;
  return ans;
}
long long gcd(long long x, long long y) {
  while (y) {
    long long r = x % y;
    x = y;
    y = r;
  }
  return x;
}
void extgcd(long long a, long long b, long long& x, long long& y) {
  if (b != 0) {
    extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
}
long long mod_inv(long long a, long long modp) {
  long long x, y;
  extgcd(a, modp, x, y);
  return (modp + x % modp) % modp;
}
long long mod_fact(long long n, long long p, long long& e) {
  e = 0;
  if (n == 0) return 1;
  long long res = mod_fact(n / p, p, e);
  e += n / p;
  if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
  return res * fact[n % p] % p;
}
long long lucas(long long n, long long k) {
  if (n < 0 || k < 0 || n < k) return 0;
  long long e1, e2, e3;
  long long a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2),
            a3 = mod_fact(n - k, p, e3);
  if (e1 > e2 + e3) return 0;
  return a1 * mod_inv(a2 * a3 % p, p) % p;
}
long long crt(long long a1, long long m1, long long a2, long long m2) {
  long long g = gcd(m1, m2);
  long long k = a1 % g;
  if (k != a2 % g) return -1;
  m1 /= g, m2 /= g;
  a1 /= g, a2 /= g;
  return ((a1 + m1 - a2 % m1) % m1 * mod_inv(m2 % m1, m1) % m1 * m2 + a2) %
             (m1 * m2) * g +
         k;
}
struct fib {
  long long r[2][2];
  friend fib operator*(fib& x, fib& y) {
    fib res;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) {
        res.r[i][j] = 0;
        for (int k = 0; k < 2; ++k)
          res.r[i][j] += x.r[i][k] * y.r[k][j] % 1000000007;
        res.r[i][j] %= 1000000007;
      }
    return res;
  }
  friend fib operator+(fib& x, fib& y) {
    fib res;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) {
        res.r[i][j] = x.r[i][j] + y.r[i][j];
        res.r[i][j] %= 1000000007;
      }
    return res;
  }
  friend bool operator==(fib& x, fib& y) {
    return (x.r[0][0] == y.r[0][0] && x.r[0][1] == y.r[0][1] &&
            x.r[1][0] == y.r[1][0] && x.r[1][1] == y.r[1][1]);
  }
};
fib tr[150000 * 3];
fib ts[150000 * 3];
fib I, e;
fib mpow(fib x, int y) {
  fib res = e, b = x;
  while (y) {
    if (y & 1) res = res * b;
    b = b * b;
    y >>= 1;
  }
  return res;
}
void addT(int d, int l, int r, int x, int y, fib& c) {
  if (x < l || y > r || l > r || x > y) return;
  if (l == x && y == r) {
    tr[d] = tr[d] * c;
    if (l == r)
      ts[d] = tr[d];
    else
      ts[d] = ts[d] * c;
    return;
  }
  int o = l + r >> 1, ll = d << 1, rr = ll + 1;
  if (!(tr[d] == e)) {
    tr[ll] = tr[ll] * tr[d];
    ts[ll] = ts[ll] * tr[d];
    tr[rr] = tr[rr] * tr[d];
    ts[rr] = ts[rr] * tr[d];
    tr[d] = e;
  }
  if (y <= o)
    addT(ll, l, o, x, y, c);
  else if (x > o)
    addT(rr, o + 1, r, x, y, c);
  else
    addT(ll, l, o, x, o, c), addT(rr, o + 1, r, o + 1, y, c);
  ts[d] = ts[ll] + ts[rr];
}
fib calc(int d, int l, int r, int x, int y) {
  if (x < l || y > r || l > r || x > y) return e;
  if (l == x && y == r) {
    return ts[d];
  }
  int o = l + r >> 1, ll = d << 1, rr = ll + 1;
  if (!(tr[d] == e)) {
    tr[ll] = tr[ll] * tr[d];
    ts[ll] = ts[ll] * tr[d];
    tr[rr] = tr[rr] * tr[d];
    ts[rr] = ts[rr] * tr[d];
    tr[d] = e;
  }
  fib tmp, t1, t2;
  if (y <= o)
    tmp = calc(ll, l, o, x, y);
  else if (x > o)
    tmp = calc(rr, o + 1, r, x, y);
  else {
    t1 = calc(ll, l, o, x, o);
    t2 = calc(rr, o + 1, r, o + 1, y);
    tmp = t1 + t2;
  }
  ts[d] = ts[ll] + ts[rr];
  return tmp;
}
int main() {
  I.r[0][0] = 1;
  I.r[0][1] = 1;
  I.r[1][0] = 1;
  I.r[1][1] = 0;
  e.r[0][0] = 1;
  e.r[0][1] = 0;
  e.r[1][0] = 0;
  e.r[1][1] = 1;
  int T = 1;
  for (int cT = 1; cT <= T; ++cT) {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n * 4; ++i) {
      tr[i].r[0][0] = tr[i].r[1][1] = 1;
      tr[i].r[0][1] = tr[i].r[1][0] = 0;
    }
    for (int i = 1; i <= n; ++i) {
      int k;
      scanf("%d", &k);
      fib xx = mpow(I, k + 1);
      addT(1, 1, n, i, i, xx);
    }
    for (int i = 0; i < m; ++i) {
      int op, l, r;
      scanf("%d%d%d", &op, &l, &r);
      if (op == 1) {
        int k;
        scanf("%d", &k);
        fib xx = mpow(I, k);
        addT(1, 1, n, l, r, xx);
      }
      if (op == 2) {
        long long ans = calc(1, 1, n, l, r).r[1][1];
        printf("%I64d\n", ans);
      }
    }
  }
  return 0;
}

```