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

#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<ul> v) {
    for (ul c: v) {
        cout << c << " ";
    }
    cout << endl;
}


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

    vector<int> weight(n + 1);
    vector<int> position(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> position[i];
    }
    for (int i = 1; i <= n; ++i) {
        cin >> weight[i];
    }

    vector<int> dyrok(n + 1);
    vector<ul> summWeight(n + 1);
    for (int i = 1; i <= n; ++i) {
        summWeight[i] = summWeight[i - 1] + weight[i];
    }
    for (int i = 1; i < n; ++i) {
        dyrok[i] = position[i + 1] - position[i] - 1;
    }

    function solve = [&](int left, int right) {
        const int mod = 1000000007;
        ul total = 0;
        for (int x = left; x < right; x++) {
            if (dyrok[x] == 0) continue;
            ul leftWeigth = summWeight[x] - summWeight[left] + weight[left];
            ul rightWeigth = summWeight[right] - summWeight[x];
            ul delta = min(leftWeigth, rightWeigth) * dyrok[x];
            total += delta % mod;
        }
        return total;
    };

    for (int j = 0; j < q; ++j) {
        int x, y;
        cin >> x >> y;
        if (x < 0) {
            int pos = -x;
            int delta = y - weight[pos];
            weight[pos] = y;
            for (int i = pos; i <= n; ++i) {
                summWeight[i] += delta;
            }
        } else {
            cout << solve(x, y) << endl;
        }
    }
}