#include #include #include #include #include using namespace std; using namespace atcoder; const long long mod = 1000000007; struct S { long long S; long long C; long long F; }; struct F { long long a; long long p; long long c; long long f; }; S op(S l, S r) { return S{(l.S+r.S)%mod, (l.C+r.C)%mod, (l.F+r.F)%mod}; } S e() { return S{0ll, 0ll, 0ll}; } F composition(F l, F r) { if (r.a!=-1ll){ return r; } if (l.a!=-1ll){ return F{(l.a*r.p+r.c)%mod,1ll,0ll,(l.f*r.p+r.f)%mod}; } return F{-1ll, l.p*r.p%mod, (l.c*r.p+r.c)%mod, (l.f*r.p+r.f)%mod}; } S mapping(F l, S r) { if (l.a!=-1ll){ return S{((l.a*l.p%mod+l.c)*r.C%mod+l.f*r.F%mod)%mod, r.C, r.F}; } return S{(r.S*l.p%mod+r.C*l.c%mod+l.f*r.F%mod)%mod, r.C, r.F}; } F id() { return F{-1ll, 1ll, 0ll, 0ll}; } vector fib; int main() { int N, Q; cin >> N >> Q; fib.push_back(0ll); fib.push_back(1ll); for (int i = 2; i < N; ++i) { fib.push_back((fib[i - 1] + fib[i - 2]) % mod); } vector a(N); for(int i=0;i seg(a); for(int q=0;q>t>>l>>r>>k; r+=1; if(t==0){ long long ans=k*(seg.prod(l,r).S)%mod; cout<