#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int MOD = 1e9 + 7;
int n, q;
int a[maxn], w[maxn];
long long tW[maxn], tAw[maxn];
void updateW(int x, int delta) {
  for (; x < maxn; x += x & -x) tW[x] += delta;
}
long long getW(int x, int y) {
  long long res = 0;
  for (; y > 0; y -= y & -y) res += tW[y];
  x--;
  for (; x > 0; x -= x & -x) res -= tW[x];
  return res;
}
void updateAw(int x, long long delta) {
  for (; x < maxn; x += x & -x) tAw[x] += delta;
}
long long getAw(int x, int y) {
  long long res = 0;
  for (; y > 0; y -= y & -y) res = (res + tAw[y]) % MOD;
  x--;
  for (; x > 0; x -= x & -x) res = (res - tAw[x] + MOD) % MOD;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  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];
  for (int i = 1; i <= n; ++i) {
    updateW(i, w[i]);
    updateAw(i, 1ll * w[i] * a[i] % MOD);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      updateW(x, -w[x]);
      updateAw(x, (-1ll * w[x] * a[x] % MOD + MOD) % MOD);
      w[x] = y;
      updateW(x, w[x]);
      updateAw(x, 1ll * w[x] * a[x] % MOD);
    } else {
      int l = x, r = y, k = y;
      long long s = getW(x, y);
      while (l <= r) {
        int m = (l + r) >> 1;
        if (getW(x, m) * 2 >= s) {
          k = m;
          r = m - 1;
        } else {
          l = m + 1;
        }
      }
      long long lo =
          (1ll * a[k] * getW(x, k) % MOD - getAw(x, k) % MOD + MOD) % MOD;
      long long hi =
          (getAw(k + 1, y) % MOD - 1ll * a[k] * getW(k + 1, y) % MOD + MOD) %
          MOD;
      cout << (lo + hi) % MOD << "\n";
    }
  }
  return 0;
}
