#include <bits/stdc++.h>
using namespace std;
struct Fenwick {
  vector<long long int> bit;
  long long int size;
  void modify(long long int j, long long int v) {
    j++;
    for (; j < size; j += j & -j) bit[j] += v;
  }
  long long int query(long long int j) {
    j++;
    long long int v = 0;
    for (; j > 0; j -= j & -j) v += bit[j];
    return v;
  }
  long long int rangequery(long long int a, long long int b) {
    if (b < a) return 0;
    return query(b) - query(a - 1);
  }
  void rangeupdate(long long int a, long long int b, long long int v) {
    modify(a, v);
    modify(b + 1, -v);
  }
  Fenwick(long long int s) {
    s += 3;
    size = s;
    bit = vector<long long int>(s, 0);
  }
};
struct FenwickM {
  vector<long long int> bit;
  long long int size;
  void modify(long long int j, long long int v) {
    v %= 1000000007;
    v = (v + 1000000007) % 1000000007;
    j++;
    for (; j < size; j += j & -j) bit[j] = (bit[j] + v) % 1000000007;
  }
  long long int query(long long int j) {
    j++;
    long long int v = 0;
    for (; j > 0; j -= j & -j) v = (bit[j] + v) % 1000000007;
    return v;
  }
  long long int rangequery(long long int a, long long int b) {
    return (query(b) - query(a - 1) + 1000000007) % 1000000007;
  }
  void rangeupdate(long long int a, long long int b, long long int v) {
    modify(a, v);
    modify(b + 1, -v);
  }
  FenwickM(long long int s) {
    s += 3;
    size = s;
    bit = vector<long long int>(s, 0);
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, q;
  cin >> n >> q;
  vector<long long int> X(n + 1);
  vector<long long int> W(n + 1);
  vector<pair<long long int, long long int> > Q(q);
  vector<long long int> beg;
  Fenwick pref(200005);
  FenwickM data(200005);
  for (long long int i = 1; i <= n; i++) cin >> X[i];
  for (long long int i = 1; i <= n; i++) cin >> W[i];
  beg = W;
  for (long long int i = 0; i < q; i++) {
    cin >> Q[i].first >> Q[i].second;
  }
  for (long long int i = 1; i <= n; i++) {
    pref.modify(i, W[i]);
    data.modify(i, (i - X[i]) * W[i]);
  }
  for (long long int k = 0; k < q; k++) {
    if (Q[k].first < 0) {
      long long int i = -Q[k].first;
      pref.modify(i, Q[k].second - W[i]);
      data.modify(i, -(i - X[i]) * W[i]);
      data.modify(i, (i - X[i]) * Q[k].second);
      W[i] = Q[k].second;
    } else {
      long long int L = Q[k].first, R = Q[k].second;
      long long int l = L, r = R;
      long long int med = L - 1;
      if (L == R) {
        cout << "0\n";
        continue;
      }
      while (l <= r) {
        long long int mid = (l + r) / 2;
        if (pref.rangequery(L, mid) <= pref.rangequery(mid + 1, R)) {
          med = mid;
          l = mid + 1;
        } else
          r = mid - 1;
      }
      long long int ans = 0;
      if (med >= L)
        ans = (pref.rangequery(L, med) % 1000000007 * (X[med + 1] - med - 1) %
                   1000000007 +
               data.rangequery(L, med)) %
              1000000007;
      med += 2;
      if (med <= R)
        ans = (ans -
               pref.rangequery(med, R) % 1000000007 * (X[med - 1] - med + 1) %
                   1000000007 -
               data.rangequery(med, R)) %
              1000000007;
      cout << (ans % 1000000007 + 1000000007) % 1000000007 << "\n";
    }
  }
}
