#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int maxn = 2e5 + 7;
int n, q, a[maxn], w[maxn];
struct Fenwick1 {
  long long bs[maxn];
  void add(int x, long long y) {
    for (; x <= n; x += x & -x) bs[x] += y;
  }
  long long sum(int x) {
    long long s = 0;
    for (; x >= 1; x -= x & -x) s += bs[x];
    return s;
  }
} B0;
struct Fenwick {
  int bs[maxn];
  void add(int x, int y) {
    for (; x <= n; x += x & -x) (bs[x] += y) %= mod;
  }
  long long sum(int x) {
    int s = 0;
    for (; x >= 1; x -= x & -x) (s += bs[x]) %= mod;
    return s;
  }
} B1;
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i), a[i] -= i;
  for (int i = 1; i <= n; ++i) scanf("%d", w + i);
  for (int i = 1; i <= n; ++i)
    B0.add(i, w[i]), B1.add(i, w[i] * 1ll * a[i] % mod);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      int dt = y - w[x];
      w[x] = y;
      B0.add(x, dt);
      B1.add(x, dt * 1ll * a[x] % mod);
    } else {
      long long sl = B0.sum(x - 1), su = B0.sum(y) - sl;
      su = (su + 1) / 2;
      int l = x, r = y;
      while (l < r) {
        int m = (l + r) >> 1;
        if (B0.sum(m) - sl >= su)
          r = m;
        else
          l = m + 1;
      }
      int m = l;
      long long ans = (B1.sum(y) - B1.sum(m)) -
                      (B0.sum(y) - B0.sum(m)) % mod * 1ll * (a[m]) % mod -
                      (B1.sum(m) - B1.sum(x - 1)) +
                      (B0.sum(m) - B0.sum(x - 1)) % mod * (a[m]) % mod;
      ans = (ans % mod + mod) % mod;
      printf("%d\n", int(ans));
    }
  }
}
