#include <bits/stdc++.h>
using namespace std;
const long long mod = 1LL * 1000 * 1000 * 1000 + 7;
long long ftree_S[200005];
long long ftree_wa[200005];
long long a[200005], w[200005];
void upd(long long *ftree, long long x, long long d) {
  for (int i = x; i < 200005; i |= i + 1) ftree[i] = ftree[i] + d;
}
long long normm(long long a) {
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
long long norm(long long a) { return normm((a % mod)); }
long long mul(long long a, long long b) { return ((a * 1ll * b) % mod); }
long long second(long long *ftree, long long x) {
  long long res = 0;
  for (int i = x; i >= 0; i = (i & (i + 1)) - 1) res += ftree[i];
  return res;
}
long long second(long long *ftree, long long l, long long r) {
  return second(ftree, r - 1) - second(ftree, l - 1);
}
int n, q;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    upd(ftree_S, i, w[i]);
    upd(ftree_wa, i, mul(w[i], a[i]));
  }
  for (int i = 0; i < q; i++) {
    long long x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      upd(ftree_S, x, -w[x]);
      upd(ftree_wa, x, -mul(w[x], a[x]));
      w[x] = y;
      upd(ftree_S, x, w[x]);
      upd(ftree_wa, x, mul(w[x], a[x]));
    } else {
      long long l = x, r = y + 1;
      while (r - l > 1) {
        long long mid = (r + l) / 2;
        if (2 * second(ftree_S, x, mid) > second(ftree_S, x, y + 1))
          r = mid;
        else
          l = mid;
      }
      long long res = 0;
      res = norm(mul(norm(second(ftree_S, x, l)), a[l]) -
                 norm(second(ftree_wa, x, l)));
      res = norm(res + norm(second(ftree_wa, l, y + 1)) -
                 mul(norm(second(ftree_S, l, y + 1)), a[l]));
      cout << res << endl;
    }
  }
}
