#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, bool f) {
    for (; i < T.size(); i = (i | (i + 1)))
      if (f)
        T[i] = (T[i] + v) % ABS;
      else
        T[i] = T[i] + v;
  }
  long long sum(int r) {
    long long res = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) res = res + T[r];
    return res;
  }
  long long sum(int l, int r) { return sum(r) - sum(l - 1); }
  long long fi(int i) { return sum(i, i); }
};
long long posn(long long x) {
  if (x >= ABS) x -= ABS;
  if (x < 0) x += ABS;
  return x;
}
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], 0);
    Fwa.add(i, w[i] * a[i], 1);
  }
  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, 0);
      cw = Fwa.fi(l);
      Fwa.add(l, r * a[l] - cw, 1);
    } else {
      l--, r--;
      if (l == r) {
        cout << 0 << endl;
        continue;
      }
      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;
      if (2 * S.sum(l, L) < SM)
        k = R;
      else
        k = L;
      long long ans = 0;
      ans = posn(a[k] * S.sum(l, k) - Fwa.sum(l, k));
      ans = posn(ans + Fwa.sum(k, r) - a[k] * S.sum(k, r));
      ans = posn(ans % ABS);
      cout << ans << endl;
    }
  }
  return 0;
}
