#include <bits/stdc++.h>
using namespace std;
const int nmax = 200005;
const long long mod = 1000 * 1000 * 1000 + 7;
long long aib[nmax], fft[nmax], a[nmax], w[nmax];
int n, i, j, q, tip;
long long l, r, poz, val, opt, ans, aa, b, tot;
inline int lbit(int x) { return (((x ^ (x - 1)) & x)); }
void update(long long poz, long long val) {
  long long vv = ((1LL * a[poz] * val) % mod + mod) % mod;
  for (int idx = poz; idx <= n; idx += lbit(idx)) {
    aib[idx] = aib[idx] + val;
    fft[idx] = (fft[idx] + vv);
    fft[idx] = fft[idx] - mod * (fft[idx] >= mod);
  }
}
long long compute(int poz, int p) {
  long long ret1 = 0, ret2 = 0;
  for (int idx = poz; idx > 0; idx -= lbit(idx)) {
    ret1 += aib[idx];
    ret2 = (ret2 + fft[idx]);
    ret2 = ret2 - mod * (ret2 >= mod);
  }
  if (!p) return ret1;
  return ret2;
}
int find_kth(long long x) {
  int ret = 0;
  long long avem = 0;
  for (int p = 17; p >= 0; p--)
    if (ret + (1 << p) < n && avem + aib[ret + (1 << p)] <= x) {
      ret += (1 << p);
      avem += aib[ret];
    }
  ret++;
  return ret;
}
bool chk(int val) { return (compute(val - 1, 0) - compute(l - 1, 0) <= tot); }
long long cc(long long x) { return ((1LL * x * (x + 1)) / 2) % mod; }
long long calc(long long opt) {
  ans =
      compute(l - 1, 1) - compute(opt - 1, 1) - compute(opt, 1) + compute(r, 1);
  ans = (ans + 2 * mod) % mod;
  ans = (1LL * ans +
         1LL * ((compute(opt - 1, 0) - compute(l - 1, 0)) % mod) * a[opt] -
         1LL * ((compute(r, 0) - compute(opt, 0)) % mod) * a[opt]) %
        mod;
  ans = (ans + mod) % mod;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> q;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (i = 1; i <= n; i++) {
    cin >> w[i];
    update(i, w[i]);
  }
  long long ret = 0;
  for (i = 1; i <= q; i++) {
    cin >> aa >> b;
    if (aa < 0)
      tip = 1, aa *= -1;
    else
      tip = 2;
    if (tip == 1) {
      poz = aa;
      val = b;
      update(poz, val - w[poz]);
      w[poz] = val;
    } else {
      l = aa;
      r = b;
      ans = 0;
      opt = l;
      opt = find_kth((-compute(l - 1, 0) + compute(r, 0)) / 2);
      tot = (-compute(l - 1, 0) + compute(r, 0)) / 2;
      for (int p = 17; p >= 0; p--)
        if (opt + (1 << p) <= r && chk(opt + (1 << p))) opt += (1 << p);
      ret = calc(opt);
      cout << ret << '\n';
    }
  }
  return 0;
}
