#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 7;
const long long ABS = 1e9 + 7;
struct Fenv {
  vector<long long> T;
  void init(int n) { T.resize(n); }
  void add(int i, long long v) {
    for (; i < T.size(); i = (i | (i + 1))) T[i] = (T[i] + v) % ABS;
  }
  long long sum(int r) {
    long long res = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) res = (res + T[r]) % ABS;
    return res;
  }
  long long sum(int l, int r) { return sum(r) - sum(l - 1); }
  long long fi(int i) { return sum(i, i); }
};
int main() {
  int n, q;
  cin >> n >> q;
  Fenv Fwa, S;
  vector<long long> a(n), w(n);
  Fwa.init(n), S.init(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    S.add(i, w[i]);
    Fwa.add(i, w[i] * a[i]);
  }
  for (; q > 0; --q) {
    int l, r;
    cin >> l >> r;
    if (l < 0) {
      l *= -1;
      l--;
      long long cw = S.fi(l);
      S.add(l, r - cw);
      cw = Fwa.fi(l);
      Fwa.add(l, r * a[l] - cw);
    } else {
      l--, r--;
      long long SM = S.sum(l, r);
      int L = l, R = r + 1;
      while (L + 1 < R) {
        int m = (L + R) / 2;
        if (2 * S.sum(l, m) >= SM)
          R = m;
        else
          L = m;
      }
      int k = R;
      long long ans = (a[k] * S.sum(l, k - 1) - Fwa.sum(l, k - 1)) % ABS;
      ans = ans + (Fwa.sum(k, r) - a[k] * S.sum(k, r)) % ABS;
      ans = ans % ABS;
      cout << ans << endl;
    }
  }
  return 0;
}
