#include <bits/stdc++.h>
using namespace std;
const long long maxn = 200005, tt = 1e9 + 7;
long long n, Q, a[maxn], w[maxn], T[maxn], t[4 * maxn], t1[maxn];
void Ins(long long x, long long y) {
  for (long long i = x; i <= n; i += (i & (-i))) T[i] += y;
}
long long Get(long long x) {
  long long r = 1;
  for (long long i = x; i; i -= (i & (-i))) r += T[i];
  return r;
}
void ins1(long long x, long long y) {
  for (long long i = x; i <= n; i += (i & (-i))) t1[i] = (t1[i] + y) % tt;
}
long long get1(long long x) {
  long long r = 1;
  for (long long i = x; i; i -= (i & (-i))) r = (r + t1[i]) % tt;
  return r;
}
long long get(long long L, long long R) {
  long long l = L, r = R, all = Get(R) - Get(L - 1), ret = R;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (2 * (Get(mid) - Get(l - 1)) >= all)
      ret = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  return ret;
}
void ins(long long x, long long l, long long r, long long p) {
  if (l == r) {
    t[x] = 1ll * a[l] * w[l] % tt;
    return;
  }
  long long mid = (l + r) >> 1;
  if (p <= mid)
    ins(2 * x, l, mid, p);
  else
    ins(2 * x + 1, mid + 1, r, p);
  t[x] = (t[2 * x] + t[2 * x + 1]) % tt;
}
long long query(long long x, long long l, long long r, long long ql,
                long long qr) {
  if (l == ql && r == qr) return t[x];
  long long mid = (l + r) >> 1;
  if (qr <= mid)
    return query(2 * x, l, mid, ql, qr);
  else if (ql > mid)
    return query(2 * x + 1, mid + 1, r, ql, qr);
  else
    return (query(2 * x, l, mid, ql, mid) +
            query(2 * x + 1, mid + 1, r, mid + 1, qr)) %
           tt;
}
signed main() {
  scanf("%lld%lld", &n, &Q);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (long long i = 1; i <= n; i++)
    scanf("%lld", &w[i]), Ins(i, w[i]), ins(1, 1, n, i), ins1(i, w[i] * i % tt);
  for (long long i = 1; i <= Q; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    if (x < 0) {
      Ins(-x, -w[-x]);
      ins1(-x, tt - w[-x] * (-x) % tt);
      w[-x] = y;
      Ins(-x, y);
      ins1(-x, y * (-x) % tt);
      ins(1, 1, n, -x);
    } else {
      long long p = get(x, y), ret = 0;
      if (p != x)
        ret += ((a[p] - p) * (Get(p - 1) - Get(x - 1)) % tt -
                query(1, 1, n, x, p - 1) + get1(p - 1) - get1(x - 1)) %
               tt;
      if (p != y)
        ret += (query(1, 1, n, p + 1, y) - (a[p] - p) * (Get(y) - Get(p)) % tt -
                get1(y) + get1(p)) %
               tt;
      ret = (ret % tt + tt) % tt;
      printf("%lld\n", ret);
    }
  }
  return 0;
}
