#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
const int mod = 1e9 + 7;
const int maxn = 200200;
int n, q, a[maxn];
struct Node {
  int l, r;
  int val;
} tr[maxn * 3];
long long w[maxn];
struct BIT {
  long long a[maxn * 2];
  void add(int x, long long k) {
    while (x <= 400000) {
      a[x] += k;
      x += (x & -x);
    }
  }
  long long ask(int x) {
    long long ret = 0;
    while (x) {
      ret += a[x];
      x -= (x & -x);
    }
    return ret;
  }
  long long sum(int l, int r) { return ask(r) - ask(l - 1); }
} lzt1, lzt2;
void build(int i, int l, int r) {
  tr[i].l = l, tr[i].r = r;
  if (l == r) {
    tr[i].val = w[tr[i].l];
    return;
  }
  int md = (l + r) >> 1;
  build((i << 1), l, md);
  build((i << 1 | 1), md + 1, r);
  tr[i].val = tr[(i << 1)].val + tr[(i << 1 | 1)].val;
}
void update(int i, int l, int r) {
  if (tr[i].l == tr[i].r) {
    tr[i].val = r;
    return;
  }
  int md = (tr[i].l + tr[i].r) >> 1;
  if (md >= l)
    update((i << 1), l, r);
  else
    update((i << 1 | 1), l, r);
  tr[i].val = tr[(i << 1)].val + tr[(i << 1 | 1)].val;
}
int fnd(int i, long long o) {
  if (tr[i].l == tr[i].r) {
    return tr[i].l;
  }
  if (tr[(i << 1)].val >= o)
    return fnd((i << 1), o);
  else
    return fnd((i << 1 | 1), o - tr[(i << 1)].val);
}
int main() {
  n = read(), q = read();
  for (register int i = (int)(1); i <= (int)(n); i++) a[i] = read() - i + 1;
  for (register int i = (int)(1); i <= (int)(n); i++) {
    w[i] = read();
    lzt1.add(i, w[i]);
    lzt2.add(i, w[i] * 1ll * a[i] % mod);
  }
  build(1, 1, n);
  while (q--) {
    int l = read(), r = read();
    if (l < 0) {
      l = -l;
      lzt1.add(l, -w[l]);
      lzt2.add(l, -(w[l] * 1ll * a[l]) % mod);
      w[l] = r;
      lzt1.add(l, w[l]);
      lzt2.add(l, w[l] * 1ll * a[l] % mod);
      update(1, l, r);
    } else {
      long long L = lzt1.ask(l - 1), R = lzt1.ask(r);
      long long nw = R - L;
      int k = fnd(1, (L + R) >> 1ll);
      long long ans = a[k] * 1ll * (lzt1.sum(l, k - 1) % mod) % mod -
                      lzt2.sum(l, k - 1) % mod + lzt2.sum(k + 1, r) % mod -
                      a[k] * 1ll * (lzt1.sum(k + 1, r) % mod) % mod;
      ans = (ans % mod + mod) % mod;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
