#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
const int maxn = 2e5;
const int maxnode = maxn << 2;
int n, q;
long long p[maxn + 5], ai[maxn + 5], si[maxn + 5];
long long tr[maxnode + 5], lz[maxnode + 5];
void Add(int x, long long v) {
  for (; x <= n; x += x & (-x)) si[x] += v;
}
long long Sum(int x) {
  long long r = 0;
  for (; x; x -= x & (-x)) r += si[x];
  return r;
}
void Build(int x, int l, int r) {
  if (l == r)
    tr[x] = Sum(l) % P * (p[l + 1] - p[l] - 1) % P;
  else {
    Build((x << 1), l, ((l + r) >> 1));
    Build(((x << 1) | 1), ((l + r) >> 1) + 1, r);
    tr[x] = (tr[(x << 1)] + tr[((x << 1) | 1)]) % P;
  }
}
void PushDown(int x, int l, int r) {
  lz[(x << 1)] = (lz[(x << 1)] + lz[x]) % P;
  lz[((x << 1) | 1)] = (lz[((x << 1) | 1)] + lz[x]) % P;
  tr[(x << 1)] =
      (tr[(x << 1)] +
       (p[((l + r) >> 1) + 1] - p[l] - (((l + r) >> 1) + 1 - l)) * lz[x]) %
      P;
  tr[((x << 1) | 1)] =
      (tr[((x << 1) | 1)] +
       (p[r + 1] - p[((l + r) >> 1) + 1] - (r - ((l + r) >> 1))) * lz[x]) %
      P;
  lz[x] = 0;
}
void Upd(int x, int l, int r, int ll, int rr, long long v) {
  if (ll <= l && r <= rr) {
    lz[x] = (lz[x] + v) % P;
    tr[x] = (tr[x] + (p[r + 1] - p[l] - (r + 1 - l)) * v) % P;
  } else {
    PushDown(x, l, r);
    if (ll <= ((l + r) >> 1)) Upd((x << 1), l, ((l + r) >> 1), ll, rr, v);
    if (((l + r) >> 1) < rr)
      Upd(((x << 1) | 1), ((l + r) >> 1) + 1, r, ll, rr, v);
    tr[x] = (tr[(x << 1)] + tr[((x << 1) | 1)]) % P;
  }
}
long long Query(int x, int l, int r, int ll, int rr) {
  if (ll <= l && r <= rr) return tr[x];
  PushDown(x, l, r);
  long long ret = 0;
  if (ll <= ((l + r) >> 1)) ret = Query((x << 1), l, ((l + r) >> 1), ll, rr);
  if (((l + r) >> 1) < rr)
    ret = (ret + Query(((x << 1) | 1), ((l + r) >> 1) + 1, r, ll, rr)) % P;
  return ret;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%lld", p + i);
  for (int i = 1; i <= n; ++i) scanf("%lld", ai + i), Add(i, ai[i]);
  Build(1, 0, n - 1);
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a < 0) {
      a = -a;
      long long da = b - ai[a];
      ai[a] = b;
      Add(a, da);
      if (a <= n - 1) Upd(1, 0, n - 1, a, n - 1, (da + P) % P);
    } else {
      long long sl = Sum(a - 1), sr = Sum(b);
      int l = a, r = b - 1, pt = a - 1;
      while (l <= r) {
        if (Sum(((l + r) >> 1)) - sl < sr - Sum(((l + r) >> 1)))
          pt = ((l + r) >> 1), l = ((l + r) >> 1) + 1;
        else
          r = ((l + r) >> 1) - 1;
      }
      long long ans = 0;
      if (pt >= a) {
        ans = (ans + Query(1, 0, n - 1, a, pt)) % P;
        ans = (ans - sl % P * (p[pt + 1] - p[a] - (pt - a + 1)) + P) % P;
      }
      if (pt + 1 <= b - 1) {
        ans = (ans - Query(1, 0, n - 1, pt + 1, b - 1) + P) % P;
        ans = (ans + sr % P * (p[b] - p[pt + 1] - (b - 1 - pt))) % P;
      }
      printf("%lld\n", ans);
    }
  }
  return 0;
}
