#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <regex> //for __gcd
#include <assert.h>

#define ul unsigned long long
#define ll long long
#define fastio ios_base :: sync_with_stdio(false), cin.tie(0), cout.tie(0)

using namespace std;

void println(vector<int> v) {
    for (int c: v) {
        cout << c << " ";
    }
    cout << endl;
}

void println(vector<ll> v) {
    for (ll c: v) {
        cout << c << " ";
    }
    cout << endl;
}

//fenvick start
const int mod = 1000000007;

ll sumOnTree(int x, vector<ll> &tree) {
    ll res = 0;
    for (; x >= 0; x = (x & (x + 1)) - 1) {
        res += tree[x];
    }
    return res;
}

ll sumOnTree(int L, int R, vector<ll> &tree) {
    return sumOnTree(R, tree) - sumOnTree(L - 1, tree);
}

void updateTree(int x, int delta, vector<ll> &tree) {
    for (; x < tree.size(); x = (x | (x + 1))) {
        tree[x] += delta;
    }
}

ll sumOnTreeMod(int x, vector<ll> &tree) {
    ll res = 0;
    for (; x >= 0; x = (x & (x + 1)) - 1) {
        res += tree[x];
        if (res >= mod) res -= mod;
    }
    return res;
}

ll sumOnTreeMod(int L, int R, vector<ll> &tree) {
    ll res = sumOnTreeMod(R, tree) - sumOnTreeMod(L - 1, tree);
    if (res < 0) res += mod;
    return res;
}

void updateTreeMod(int x, ll delta, vector<ll> &tree) {
//    delta %= mod;
//    if (delta < 0) delta += mod;
//    assert(delta >= 0);
    for (; x < tree.size(); x = (x | (x + 1))) {
        tree[x] += delta;
        tree[x] %= mod;
        //if (tree[x] >= mod) tree[x] -= mod;
    }
}
//fenvick end

int main() {
//#ifndef NDEBUG
//    freopen("input.txt", "r", stdin);
//#endif // DEBUG
    fastio;
    unsigned n, q;
    cin >> n >> q;

    vector<int> weight(n);
    vector<int> position(n);
    for (int i = 0; i < n; ++i) {
        cin >> position[i];
        position[i] -= i;
    }
    vector<ll> tree(n);
    vector<ll> treeMod(n);
    for (int i = 0; i < n; ++i) {
        cin >> weight[i];
        updateTree(i, weight[i], tree);
        updateTreeMod(i, position[i] * (ll) weight[i], treeMod);
    }

    function solveSlow = [&](int left, int right) {
        ll total = 0;
        ll leftWeigth = 0;
        ll rightWeigth = sumOnTree(left, right, tree);
        for (int x = left; x < right; x++) {
            leftWeigth += weight[x];
            rightWeigth -= weight[x];
            if (position[x + 1] - position[x] == 0) continue;
            ll delta = min(leftWeigth, rightWeigth) * (position[x + 1] - position[x]);
            total += delta % mod;
        }
        return total % mod;
    };

    function solveFast = [&](int x, int y) {
        const int M = mod;
        assert(M == 1e9 + 7);
        ll sum = sumOnTree(x, y, tree);
        ll need = sum / 2 + sumOnTree(x - 1, tree);
        int l = x - 1;
        int r = y;
        while (l < r - 1) {
            int m = (l + r) / 2;
            if (sumOnTree(m, tree) <= need) {
                l = m;
            } else {
                r = m;
            }
        }
        int p = l + 1;
        ll ans = -sumOnTreeMod(x, p, treeMod) + sumOnTreeMod(p + 1, y, treeMod);
        if (ans < 0) ans += M;
        ans += (sumOnTree(x, p, tree) % M * (ll) position[p]) % M;
        if (ans >= M) ans -= M;
        ans -= (sumOnTree(p + 1, y, tree) % M * (ll) position[p]) % M;
        if (ans < 0) ans += M;
        return ans;
    };

    for (int j = 0; j < q; ++j) {
        int x, y;
        cin >> x;
        cin >> y;
        if (x < 0) {
            x = abs(x);
            x--;
            updateTree(x, -weight[x], tree);
            updateTreeMod(x, -(position[x] * (ll) weight[x]), treeMod);
            weight[x] = y;
            updateTree(x, weight[x], tree);
            updateTreeMod(x, position[x] * (ll) weight[x], treeMod);
        } else {
            cout << solveFast(x - 1, y - 1) << endl;
        }
    }
}