#include <bits/stdc++.h>
using namespace std;
const long long P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
long long mod(long long a) {
  a %= P;
  if (a < 0) a += P;
  return a;
}
long long add(long long a, long long b) { return mod(a + b); }
long long mul(long long a, long long b) { return mod(a * b); }
const long long N = 1e6 + 10;
long long n, q, pos;
long long a[N], w[N];
long long s1[N << 2], s2[N << 2], sum;
void pu(long long o) {
  s1[o] = s1[(o << 1)] + s1[((o << 1) | 1)];
  s2[o] = (s2[(o << 1)] + s2[((o << 1) | 1)]) % P;
}
void update(long long o, long long l, long long r, long long first,
            long long v) {
  if (l == r) {
    s1[o] = v;
    s2[o] = (long long)v * a[l] % P;
    return;
  }
  if (((l + r) >> 1) >= first)
    update((o << 1), l, ((l + r) >> 1), first, v);
  else
    update(((o << 1) | 1), ((l + r) >> 1) + 1, r, first, v);
  pu(o);
}
long long qry1(long long o, long long l, long long r, long long ql,
               long long qr) {
  if (ql <= l && r <= qr) return s1[o];
  long long ans = 0;
  if (((l + r) >> 1) >= ql) ans += qry1((o << 1), l, ((l + r) >> 1), ql, qr);
  if (((l + r) >> 1) < qr)
    ans += qry1(((o << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr);
  return ans;
}
long long qry2(long long o, long long l, long long r, long long ql,
               long long qr) {
  if (ql <= l && r <= qr) return s2[o];
  long long ans = 0;
  if (((l + r) >> 1) >= ql) ans = qry2((o << 1), l, ((l + r) >> 1), ql, qr);
  if (((l + r) >> 1) < qr)
    (ans += qry2(((o << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr)) %= P;
  return ans;
}
void find(long long o, long long l, long long r, long long ql, long long qr) {
  if (ql <= l && r <= qr) {
    if (l == r || sum == s1[o]) pos = r;
    if (sum >= s1[o])
      sum -= s1[o];
    else
      find((o << 1), l, ((l + r) >> 1), ql, qr);
    return;
  }
  if (((l + r) >> 1) >= ql) find((o << 1), l, ((l + r) >> 1), ql, qr);
  if (((l + r) >> 1) < qr) find(((o << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr);
}
void build(long long o, long long l, long long r) {
  if (l == r) {
    s1[o] = w[l], s2[o] = (long long)a[l] * w[l] % P;
    return;
  }
  build((o << 1), l, ((l + r) >> 1)),
      build(((o << 1) | 1), ((l + r) >> 1) + 1, r);
  pu(o);
}
long long qry(long long l, long long r) {
  return add(qry2(1, 1, n, l, r), -mul(qry1(1, 1, n, l, r), a[pos]));
}
signed main() {
  scanf("%lld%lld", &n, &q);
  for (long long i = 1; i <= n; ++i) scanf("%lld", a + i), a[i] -= i;
  for (long long i = 1; i <= n; ++i) scanf("%lld", w + i);
  build(1, 1, n);
  for (long long i = 1; i <= q; ++i) {
    long long first, second;
    scanf("%lld%lld", &first, &second);
    if (first < 0)
      update(1, 1, n, -first, second);
    else {
      long long sum = qry1(1, 1, n, first, second);
      long long l = first, r = second, ans = -1;
      while (l <= r) {
        if (2 * qry1(1, 1, n, first, ((l + r) >> 1)) >= sum)
          ans = ((l + r) >> 1), r = ((l + r) >> 1) - 1;
        else
          l = ((l + r) >> 1) + 1;
      }
      pos = ans;
      {
        long long ans = 0;
        ans = add(ans, mul(a[pos], add(qry1(1, 1, n, first, pos),
                                       -qry1(1, 1, n, pos, second))));
        ans = add(ans,
                  add(-qry2(1, 1, n, first, pos), qry2(1, 1, n, pos, second)));
        printf("%lld\n", ans);
      }
    }
  }
}
