#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int mn = 2e5 + 10;
long long bit[mn], bit2[mn], sa[mn];
void upd(int a, long long b) {
  for (; a < mn; a += a & -a) bit[a] += b;
}
void upd2(int a, long long b) {
  for (; a < mn; a += a & -a) bit2[a] += b, bit2[a] %= mod;
}
long long qu(int a) {
  long long b = 0;
  for (; a; a -= a & -a) b += bit[a];
  return b;
}
long long qu2(int a) {
  long long b = 0;
  for (; a; a -= a & -a) b += bit2[a], b %= mod;
  return b;
}
long long a[mn], w[mn];
int sch(long long x) {
  int cur = 0;
  long long sum = 0;
  for (int i = 1 << 17; i; i >>= 1) {
    if (sum + bit[cur + i] <= x) sum += bit[cur += i];
  }
  return cur + 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> a[i], a[i] -= i;
  for (int i = 1; i <= n; i++)
    cin >> w[i], upd(i, w[i]), upd2(i, w[i] * a[i] % mod);
  while (q--) {
    long long l, r;
    cin >> l >> r;
    if (l < 0) {
      l = -l;
      upd(l, r - w[l]);
      upd2(l, (r - w[l]) * a[l] % mod);
      w[l] = r;
    } else {
      long long ls = qu(l - 1), rs = qu(r);
      long long sum = rs - ls;
      int c = sch(sum / 2 + ls);
      long long cs = qu(c);
      long long ans = (qu2(r) - qu2(c) - (rs - cs) % mod * a[c] % mod) -
                      (qu2(c) - qu2(l - 1) - (cs - ls) % mod * a[c] % mod);
      ans %= mod;
      if (ans < 0) ans += mod;
      printf("%lld\n", ans);
    }
  }
}
