#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 + mod) % 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 = (res + ftree[i] + mod) % mod;
  return res;
}
long long second(long long *ftree, long long l, long long r) {
  return (second(ftree, r) - second(ftree, l - 1) + mod) % mod;
}
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, w[i] * a[i] % mod);
  }
  for (int i = 0; i < q; i++) {
    long long x, y;
    cin >> x >> y;
    if (x < 0) {
      upd(ftree_S, -x, y - w[-x]);
      upd(ftree_wa, -x, (y - w[-x]) * (a[-x]) % mod);
      w[-x] = y;
    } else {
      long long l = x, r = y;
      while (r - l > 1) {
        long long mid = (r + l) / 2;
        if (2 * second(ftree_S, x, mid) > second(ftree_S, x, y))
          r = mid;
        else
          l = mid;
      }
      long long res = 0;
      res = (second(ftree_S, x, r - 1) * a[r] % mod -
             second(ftree_wa, x, r - 1) + mod) %
            mod;
      res = (res + second(ftree_wa, r + 1, y) + mod -
             second(ftree_S, r + 1, y) * a[r] % mod) %
            mod;
      cout << res << endl;
    }
  }
}
