#include <bits/stdc++.h>
using namespace std;
const int MOD = int(1e9) + 7;
int norm(int a) {
  if (a >= MOD) a -= MOD;
  if (a < 0) a += MOD;
  return a;
}
int norm(const long long &a) { return norm(int(a % MOD)); }
int mul(int a, int b) { return int((a * 1ll * b) % MOD); }
const int N = 200 * 1000 + 555;
int n, q;
int a[N], w[N];
inline bool read() {
  if (!(cin >> n >> q)) return false;
  for (int i = int(0); i < int(n); i++) assert(scanf("%d", &a[i]) == 1);
  for (int i = int(0); i < int(n); i++) assert(scanf("%d", &w[i]) == 1);
  return true;
}
long long fW[N], fAW[N];
void inc(long long f[N], int pos, long long val) {
  for (; pos < N; pos |= pos + 1) f[pos] += val;
}
long long sum(long long f[N], int pos) {
  long long ans = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1) ans += f[pos];
  return ans;
}
long long getSum(long long f[N], int l, int r) {
  return sum(f, r - 1) - sum(f, l - 1);
}
int getNSum(long long f[N], int l, int r) {
  return norm(sum(f, r - 1) - sum(f, l - 1));
}
inline void solve() {
  for (int i = int(0); i < int(n); i++) {
    a[i] -= i;
    inc(fW, i, w[i]);
    inc(fAW, i, mul(a[i], w[i]));
  }
  for (int _ = int(0); _ < int(q); _++) {
    int x, y;
    assert(scanf("%d%d", &x, &y) == 2);
    if (x < 0) {
      x = -x - 1;
      inc(fW, x, -w[x]);
      inc(fAW, x, -mul(a[x], w[x]));
      w[x] = y;
      inc(fW, x, w[x]);
      inc(fAW, x, mul(a[x], w[x]));
    } else {
      x--;
      long long sum = getSum(fW, x, y);
      int lf = x, rg = y;
      while (rg - lf > 1) {
        int mid = (lf + rg) >> 1;
        if (2 * getSum(fW, x, mid) > sum)
          rg = mid;
        else
          lf = mid;
      }
      assert(x <= lf && lf < y);
      int ans = norm(mul(a[lf], getNSum(fW, x, lf)) - getNSum(fAW, x, lf));
      ans = norm(ans +
                 norm(getNSum(fAW, lf, y) - mul(a[lf], getNSum(fW, lf, y))));
      printf("%d\n", ans);
    }
  }
}
int main() {
  cout << fixed << setprecision(15);
  if (read()) {
    solve();
  }
  return 0;
}
