#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
inline long long read() {
  register long long x = 0, f = 1;
  register char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  return x * f;
}
void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  puts("");
}
const long long mx = 1e9, mn = 1;
const long long mod = 1e9 + 7;
const long long maxn = 2e5 + 233;
long long sum[maxn << 2], pre[maxn << 2], suf[maxn << 2];
long long w[maxn], a[maxn], n, q;
void pushup(long long o, long long l, long long r) {
  sum[o] = sum[(o << 1)] + sum[(o << 1 | 1)];
  pre[o] = (pre[(o << 1)] + pre[(o << 1 | 1)]) % mod;
  suf[o] = (suf[(o << 1)] + suf[(o << 1 | 1)]) % mod;
}
void build(long long o, long long l, long long r) {
  if (l == r) {
    sum[o] = w[l];
    pre[o] = (a[l] - mn) * w[l];
    suf[o] = (mx - a[l]) * w[l];
    return;
  }
  build((o << 1), l, ((l + r) >> 1));
  build((o << 1 | 1), ((l + r) >> 1) + 1, r);
  pushup(o, l, r);
}
void modify(long long o, long long l, long long r, long long x) {
  if (l == r) {
    sum[o] = w[l];
    pre[o] = (a[l] - mn) * w[l] % mod;
    suf[o] = (mx - a[l]) * w[l] % mod;
    return;
  }
  if (x <= ((l + r) >> 1))
    modify((o << 1), l, ((l + r) >> 1), x);
  else
    modify((o << 1 | 1), ((l + r) >> 1) + 1, r, x);
  pushup(o, l, r);
}
long long query(long long a[], long long o, long long l, long long r,
                long long x, long long y) {
  if (l == x && r == y) return a[o];
  if (y <= ((l + r) >> 1))
    return query(a, (o << 1), l, ((l + r) >> 1), x, y);
  else if (((l + r) >> 1) + 1 <= x)
    return query(a, (o << 1 | 1), ((l + r) >> 1) + 1, r, x, y);
  else
    return query(a, (o << 1), l, ((l + r) >> 1), x, ((l + r) >> 1)) +
           query(a, (o << 1 | 1), ((l + r) >> 1) + 1, r, ((l + r) >> 1) + 1, y);
}
signed main() {
  n = read(), q = read();
  for (register long long i = (1); i <= long long(n); ++i) a[i] = read() - i;
  for (register long long i = (1); i <= long long(n); ++i) w[i] = read();
  build(1, 1, n);
  while (q--) {
    long long l = read(), r = read();
    if (l < 0) {
      w[-l] = r;
      modify(1, 1, n, -l);
    } else {
      long long S = query(sum, 1, 1, n, l, r);
      long long L = l, R = r, pos = 233;
      while (L <= R) {
        long long mid = (L + R) >> 1;
        long long w = query(sum, 1, 1, n, l, mid);
        if (w * 2 >= S)
          pos = mid, R = mid - 1;
        else
          L = mid + 1;
      }
      long long ans = 0;
      if (l <= pos)
        ans = (ans + (a[pos] - mn) * query(sum, 1, 1, n, l, pos)) % mod;
      if (l <= pos) ans = (ans - query(pre, 1, 1, n, l, pos)) % mod;
      if (pos + 1 <= r)
        ans = (ans + (mx - a[pos]) * query(sum, 1, 1, n, pos + 1, r)) % mod;
      if (pos + 1 <= r) ans = (ans - query(suf, 1, 1, n, pos + 1, r)) % mod;
      writeln((ans + mod) % mod);
    }
  }
  return 0;
}
