#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
template <typename T>
T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
string int_to_str_easy(long long n) {
  return n ? "" : int_to_str_easy(n / 10) + (char)('0' + n % 10);
}
template <typename T>
T sum(vector<T> v) {
  T ans = 0;
  for (T i : v) ans += i;
  return ans;
}
bool is_down(char x) { return ('a' <= x && x <= 'z'); }
bool is_upper(char x) { return ('A' <= x && x <= 'Z'); }
bool is_digit(char x) { return ('0' <= x && x <= '9'); }
string follow(string s) {
  for (int i = 0; i < s.length(); i++)
    if (is_upper(s[i])) s[i] += 'a' - 'A';
  return s;
}
const long double pi = 3.141592653589793238462643383279;
const long double log23 = 1.58496250072115618145373894394781;
const long double eps = 1e-8;
const long double zero = 0;
const long long INF = 1e18;
const int COUT = 30;
const int prost = 239;
const long long prost64 = 239;
const int two = 2;
const long long MOD = 1000000007;
const int BIG = 1e9;
const int alf = 26;
const int MAX_M = 2001;
const int MAX_N = 1e5 + 1;
const int km = (1 << 18) - 1;
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
const int bit_max = 32;
const int siz = 8 * MAX_N + 20000;
void solve() { return; }
struct matrix {
  long long a11, a12, a21, a22;
  matrix() {
    a11 = 0;
    a12 = 0;
    a21 = 0;
    a22 = 0;
  }
  matrix nul_matrix() {
    matrix ans;
    ans.a11 = 1;
    ans.a22 = 1;
    ans.a12 = 0;
    ans.a21 = 0;
    return ans;
  }
  matrix fib_matrix() {
    matrix ans;
    ans.a11 = 1;
    ans.a21 = 1;
    ans.a12 = 1;
    ans.a22 = 0;
    return ans;
  }
  matrix operator+(const matrix &t) const {
    matrix ans;
    ans.a11 = (a11 + t.a11) % MOD;
    ans.a21 = (a21 + t.a21) % MOD;
    ans.a12 = (a12 + t.a12) % MOD;
    ans.a22 = (a22 + t.a22) % MOD;
    return ans;
  }
  matrix operator*(const matrix &t) const {
    matrix ans;
    ans.a11 = ((a11 * t.a11) % MOD + (a12 * t.a21) % MOD) % MOD;
    ans.a21 = ((a21 * t.a11) % MOD + (a22 * t.a21) % MOD) % MOD;
    ans.a12 = ((a11 * t.a12) % MOD + (a12 * t.a22) % MOD) % MOD;
    ans.a22 = ((a21 * t.a12) % MOD + (a22 * t.a22) % MOD) % MOD;
    return ans;
  }
};
matrix power(matrix t, long long r) {
  if (r == 0) return t.nul_matrix();
  if (r == 1) return t;
  matrix w = power(t, r / 2);
  w = w * w;
  if (r % 2 == 1) w = w * t;
  return w;
}
int n, m;
matrix a[siz], add[siz], un;
bool want[siz];
void push(int i, int l, int r) {
  if (!want[i]) return;
  a[i] = a[i] * add[i];
  if (r - l != 1) {
    add[2 * i + 1] = add[2 * i + 1] * add[i];
    add[2 * i + 2] = add[2 * i + 2] * add[i];
    want[2 * i + 1] = true;
    want[2 * i + 2] = true;
  }
  want[i] = false;
  add[i] = add[i].nul_matrix();
}
void upd_segment(int i, int l, int r, int ql, int qr, matrix t) {
  push(i, l, r);
  if (l >= qr || r <= ql) return;
  if (l >= ql && r <= qr) {
    add[i] = t;
    want[i] = true;
    push(i, l, r);
    return;
  }
  int mid = (l + r) / 2;
  upd_segment(2 * i + 1, l, mid, ql, qr, t);
  upd_segment(2 * i + 2, mid, r, ql, qr, t);
  a[i] = a[2 * i + 1] + a[2 * i + 2];
}
matrix answer(int i, int l, int r, int ql, int qr) {
  push(i, l, r);
  if (l >= qr || r <= ql) return un;
  if (l >= ql && r <= qr) return a[i];
  int mid = (l + r) / 2;
  return answer(2 * i + 1, l, mid, ql, qr) + answer(2 * i + 2, mid, r, ql, qr);
}
void build(int i, int l, int r) {
  if (r - l == 1) {
    a[i] = un.nul_matrix();
    return;
  }
  int mid = (l + r) / 2;
  build(2 * i + 1, l, mid);
  build(2 * i + 2, mid, r);
  a[i] = a[2 * i + 1] + a[2 * i + 2];
}
int main() {
  cin.sync_with_stdio(0);
  for (int i = 0; i < siz; i++) add[i] = un.nul_matrix();
  build(0, 0, km + 1);
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    int r;
    scanf("%d", &r);
    matrix go = power(un.fib_matrix(), (long long)(r - 1));
    upd_segment(0, 0, km + 1, i, i + 1, go);
  }
  for (int i = 0; i < m; i++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      l--;
      matrix go = power(un.fib_matrix(), (long long)(x));
      upd_segment(0, 0, km + 1, l, r, go);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      l--;
      matrix go = answer(0, 0, km + 1, l, r);
      cout << go.a11 << "\n";
    }
  }
  return 0;
}

### Prompt

Your challenge is to write 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 <typename T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
template <typename T>
T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
string int_to_str_easy(long long n) {
  return n ? "" : int_to_str_easy(n / 10) + (char)('0' + n % 10);
}
template <typename T>
T sum(vector<T> v) {
  T ans = 0;
  for (T i : v) ans += i;
  return ans;
}
bool is_down(char x) { return ('a' <= x && x <= 'z'); }
bool is_upper(char x) { return ('A' <= x && x <= 'Z'); }
bool is_digit(char x) { return ('0' <= x && x <= '9'); }
string follow(string s) {
  for (int i = 0; i < s.length(); i++)
    if (is_upper(s[i])) s[i] += 'a' - 'A';
  return s;
}
const long double pi = 3.141592653589793238462643383279;
const long double log23 = 1.58496250072115618145373894394781;
const long double eps = 1e-8;
const long double zero = 0;
const long long INF = 1e18;
const int COUT = 30;
const int prost = 239;
const long long prost64 = 239;
const int two = 2;
const long long MOD = 1000000007;
const int BIG = 1e9;
const int alf = 26;
const int MAX_M = 2001;
const int MAX_N = 1e5 + 1;
const int km = (1 << 18) - 1;
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
const int bit_max = 32;
const int siz = 8 * MAX_N + 20000;
void solve() { return; }
struct matrix {
  long long a11, a12, a21, a22;
  matrix() {
    a11 = 0;
    a12 = 0;
    a21 = 0;
    a22 = 0;
  }
  matrix nul_matrix() {
    matrix ans;
    ans.a11 = 1;
    ans.a22 = 1;
    ans.a12 = 0;
    ans.a21 = 0;
    return ans;
  }
  matrix fib_matrix() {
    matrix ans;
    ans.a11 = 1;
    ans.a21 = 1;
    ans.a12 = 1;
    ans.a22 = 0;
    return ans;
  }
  matrix operator+(const matrix &t) const {
    matrix ans;
    ans.a11 = (a11 + t.a11) % MOD;
    ans.a21 = (a21 + t.a21) % MOD;
    ans.a12 = (a12 + t.a12) % MOD;
    ans.a22 = (a22 + t.a22) % MOD;
    return ans;
  }
  matrix operator*(const matrix &t) const {
    matrix ans;
    ans.a11 = ((a11 * t.a11) % MOD + (a12 * t.a21) % MOD) % MOD;
    ans.a21 = ((a21 * t.a11) % MOD + (a22 * t.a21) % MOD) % MOD;
    ans.a12 = ((a11 * t.a12) % MOD + (a12 * t.a22) % MOD) % MOD;
    ans.a22 = ((a21 * t.a12) % MOD + (a22 * t.a22) % MOD) % MOD;
    return ans;
  }
};
matrix power(matrix t, long long r) {
  if (r == 0) return t.nul_matrix();
  if (r == 1) return t;
  matrix w = power(t, r / 2);
  w = w * w;
  if (r % 2 == 1) w = w * t;
  return w;
}
int n, m;
matrix a[siz], add[siz], un;
bool want[siz];
void push(int i, int l, int r) {
  if (!want[i]) return;
  a[i] = a[i] * add[i];
  if (r - l != 1) {
    add[2 * i + 1] = add[2 * i + 1] * add[i];
    add[2 * i + 2] = add[2 * i + 2] * add[i];
    want[2 * i + 1] = true;
    want[2 * i + 2] = true;
  }
  want[i] = false;
  add[i] = add[i].nul_matrix();
}
void upd_segment(int i, int l, int r, int ql, int qr, matrix t) {
  push(i, l, r);
  if (l >= qr || r <= ql) return;
  if (l >= ql && r <= qr) {
    add[i] = t;
    want[i] = true;
    push(i, l, r);
    return;
  }
  int mid = (l + r) / 2;
  upd_segment(2 * i + 1, l, mid, ql, qr, t);
  upd_segment(2 * i + 2, mid, r, ql, qr, t);
  a[i] = a[2 * i + 1] + a[2 * i + 2];
}
matrix answer(int i, int l, int r, int ql, int qr) {
  push(i, l, r);
  if (l >= qr || r <= ql) return un;
  if (l >= ql && r <= qr) return a[i];
  int mid = (l + r) / 2;
  return answer(2 * i + 1, l, mid, ql, qr) + answer(2 * i + 2, mid, r, ql, qr);
}
void build(int i, int l, int r) {
  if (r - l == 1) {
    a[i] = un.nul_matrix();
    return;
  }
  int mid = (l + r) / 2;
  build(2 * i + 1, l, mid);
  build(2 * i + 2, mid, r);
  a[i] = a[2 * i + 1] + a[2 * i + 2];
}
int main() {
  cin.sync_with_stdio(0);
  for (int i = 0; i < siz; i++) add[i] = un.nul_matrix();
  build(0, 0, km + 1);
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    int r;
    scanf("%d", &r);
    matrix go = power(un.fib_matrix(), (long long)(r - 1));
    upd_segment(0, 0, km + 1, i, i + 1, go);
  }
  for (int i = 0; i < m; i++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      l--;
      matrix go = power(un.fib_matrix(), (long long)(x));
      upd_segment(0, 0, km + 1, l, r, go);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      l--;
      matrix go = answer(0, 0, km + 1, l, r);
      cout << go.a11 << "\n";
    }
  }
  return 0;
}

```