// I make this just for fun because i'm done
// Aimi Haraguni >> Konomi Suzuki >> Yui >>  Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi.   .. dude? 
// problems that involves any kind of persistent data structures are the best of the best, are not them?
 
// #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
// #define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(int i=int(a); i< int(b); ++i)
#define IFR(i,a,b) for(int i=int(a); i>=int(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
 
#define N 2005
// #define M 19
 
// #define mod 998244353
#define mod1 1000000007
#define mod2 1000000009
#define bas 987625403
#define sqr(x) (x)*(x)  
#define INF 1e15
 
using namespace std;
using namespace __gnu_pbds;
 
 
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> S_t;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define trace(...) fff(#__VA_ARGS__, __VA_ARGS__)
template<typename t> void fff(const char* x, t&& val1) { cout<<x<< " : "<<val1<<"\n";}
template<typename t1, typename... t2> void fff(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    fff(xd+1, val2...);
}
 
inline ll add(ll a, ll b, ll mod) { return a+b < mod? a+b : a+b-mod;}
inline ll rem(ll a, ll b, ll mod) { return a >= b? a - b: a- b + mod;}
inline ll mul(ll a, ll b, ll mod) { return (long long) a*b%mod;}
inline void Mul(ll &a, ll b, ll mod) { a = (long long) a*b%mod;}
inline ll bp(ll a, ll p, ll mod){
    ll ret;
    for(ret = 1; p; p>>=1, Mul(a, a, mod)) (p & 1) && (Mul(ret, a, mod), 1);
    return ret;
}
 
static inline void read(ll &result) {
    bool minus = false;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' and ch <= '9') break;
        ch = getchar();
    }
    (ch == '-')? minus = true: result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' or ch > '9') break;
 
        result = (result<<3)+ (result<<1) + (ch - '0');
    }
    if(minus) result = -result;
}

struct ST{
    ll n, t[1<<20];
    inline ll Op(ll a, ll b) { return add(a, b, mod1);}
    inline void build() { IFR(i, n - 1, 1) t[i] = Op(t[i<<1], t[i<<1|1]);}
    inline void modify(ll p, ll val) { for(t[p += n] = val; p>>=1; ) t[p] = Op(t[p<<1], t[p<<1|1]);}
    inline ll que(ll l, ll r){
        ll ans = 0;
        for(l += n, r += n; l < r; l>>=1, r>>=1){
            if(l&1) ans = Op(ans, t[l++]);
            if(r&1) ans = Op(t[--r], ans);
        }
        return ans;
    }
}st1, st2, st3, st4;

int main(){
    // L[i] + R[i];
    // L[i] + (ar[i + 1] - ar[i])s(i + 1) + (ar[i + 1] - ar[i])*s(i + 2, n) + R[i]
    // s(i + 1) <= s(i + 2, n)
    // (ar[i] - ar[j]) * ar[j] + 1*w[i - 1] + 2*w[i - 2] + 3*w[i - 3]...
    // a0, a1, a2, a3, .... ai
    // ai*wi + (ai - 1)*w(i-1) + (ai - 2)*w(i - 2) + ... 
    // s(ai*wi)
    // ai*s(wi) - (0*wi + 1*w(i-1) + 2*w(i-2) + ...)
    fastio;
    ll n, q; cin>>n>>q;
    vi ar(n), w(n);
    FER(i, 0, n) cin>>ar[i];
    FER(i, 0, n) cin>>w[i];
    st1.n = n, st2.n = n, st3.n = n, st4.n =n;
    FER(i, 0, n) st1.t[i + st1.n] = mul(ar[i], w[i], mod1);
    FER(i, 0, n) st2.t[i + st2.n] = mul(w[i], n - i, mod1);
    FER(i, 0, n) st3.t[i + st3.n] = w[i];
    FER(i, 0, n) st4.t[i + st4.n] = mul(w[i], i, mod1);
    st1.build(), st2.build(), st3.build(), st4.build();
    ll x, y;
    auto QL = [&](ll l, ll r){
        // from l to r, with  r - 1 static
        // l ..... (r - 1)
        //  .....43210
        // ar[i]*w[i] + (ar[i] - 1)*w[i - 1] + (ar[i] - 2)*w[i - 2] + ...
        // menos -> a[i]*w[i] + a[i - 1]*w[i - 1] + a[i - 2]*w[i -2];
        ll tot = mul(ar[r - 1], st3.que(l, r), mod1);
        ll ret = st2.que(l, r);
        ll ket = mul(n - (r - 1), st3.que(l, r), mod1);
        tot = rem(tot, rem(ret, ket, mod1), mod1);
        tot = rem(tot, st1.que(l, r), mod1);
        // trace(jael);
        return tot;
    };
    auto QR = [&](ll l, ll r){
        ll tot = st1.que(l, r);
        ll ret = mul(ar[l], st3.que(l, r), mod1); //+ 0 * w[i] + 1*w[i + 1] + ...
        ll ket = rem(st4.que(l, r), mul(l, st3.que(l, r), mod1), mod1);
        tot = rem(tot, add(ket, ret, mod1), mod1);
        return tot;
    };
    // from l, to r >
    // aca es a[i]*w[i] + (a[i + 1])*w[i + 1] + (a[i + 2](w[i + 2])...
    // menos a[i]*w[i] + (a[i] + 1)*w[i + 1] + (a[i] + 2)*w[i + 2] + ...

    auto Que = [&](ll l, ll r){
        if(r - l == 1) return 0LL;
        ll ini = l, fin = r + 1;
        // tengo que buscar
        // s(l, mid) <= s(mid, r)
        // 2*(l, mid) <= total
        // s(l, mid) <= total/2
        // and s(l, mid + 1) > s(mid, r);
        ll total = st3.que(l, r);
        // trace(ini, fin);
        FER(i, 0, 100){
            if(ini + 1 == fin) break;
            ll mid = (ini + fin)>>1;
            if(st3.que(l, mid) <= st3.que(mid, r)) ini = mid;
            else fin = mid;
        }
        // trace(ini, fin);
        fin = ini;
        // fin = 2;
        // FER(i, 0, n) cout<<ar[i]<<" "; cout<<"\n";
        // FER(i, 0, n) cout<<st3.que(i, i + 1)<<" "; cout<<"\n";
        auto L = QL(l, fin);
        auto R = QR(fin - 1, r);
        // trace(L, R, fin);
        return add(L, R, mod1);
    };
    FER(i, 0, q){
        cin>>x>>y;
        if(x < 0){
            x = -x;
            x--;
            st1.modify(x, mul(y, ar[x], mod1));
            st2.modify(x, mul((n - x), y, mod1));
            st3.modify(x, y);
            st4.modify(x, mul(x, y, mod1));
        }
        else{
            x--;
            auto everule = Que(x, y);
            cout<<everule<<"\n";
        }
    }
    return 0;
}