#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 7;
const long long MOD = 1000 * 1000 * 1000 + 7;
long long mod(long long n) { return (n % MOD + MOD) % MOD; }
long long n, q;
long long a[MAXN], w[MAXN];
void read() {
  cin >> n >> q;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < n; ++i) cin >> w[i];
}
long long f[MAXN], f1[MAXN];
void add_(long long i, long long x) {
  for (; i < MAXN; i |= (i + 1)) {
    f[i] += x;
  }
}
long long getpr_(long long i) {
  long long ans = 0;
  for (; i >= 0; i = (i & (i + 1)) - 1) {
    ans += f[i];
  }
  return ans;
}
long long get_(long long l, long long r) { return getpr_(r) - getpr_(l - 1); }
void add1_(long long i, long long x) {
  long long t = x * (i - a[i]);
  for (; i < MAXN; i |= (i + 1)) {
    f1[i] += t;
    f1[i] = mod(f1[i]);
  }
}
long long getpr1_(long long i) {
  long long ans = 0;
  for (; i >= 0; i = (i & (i + 1)) - 1) {
    ans += f1[i];
  }
  return ans;
}
long long get1_(long long l, long long r) {
  return mod(getpr1_(r) - getpr1_(l - 1));
}
long long p[MAXN];
void solve() {
  for (long long i = 0; i < n; ++i) add_(i, w[i]);
  for (long long i = 0; i < n; ++i) add1_(i, w[i]);
  for (long long i = 0; i < n; ++i) p[i] = a[i] - i;
}
void upd(long long i, long long x) {
  long long delt = x - w[i];
  add_(i, delt);
  add1_(i, delt);
  w[i] = x;
}
long long getl(long long l, long long r) {
  long long bl = a[l] - 1;
  long long br = a[r] - (r - l) + 1;
  long long sum = get_(l, r);
  while (bl < br - 1) {
    long long bm = (bl + br) / 2;
    auto t = upper_bound(p + l, p + r + 1, bm - l);
    long long sum1 = get_(t - p, r);
    if (sum < sum1 * 2)
      bl = bm;
    else
      br = bm;
  }
  return br;
}
long long getans(long long l, long long r, long long tl) {
  auto t = upper_bound(p + l, p + r + 1, tl - l);
  long long bl = t - p - 1;
  long long ans = 0;
  ans += mod(mod(get_(l, bl)) * (tl - l)) + get1_(l, bl);
  ans -= mod(mod(get_(bl + 1, r)) * (tl - l)) + get1_(bl + 1, r);
  return mod(ans);
}
long long get(long long l, long long r) {
  long long tl = getl(l, r);
  return getans(l, r, tl);
}
void print() {
  for (long long i = 0; i < q; ++i) {
    long long x, y;
    cin >> x >> y;
    if (x < 0) {
      upd(-x - 1, y);
    } else {
      cout << get(x - 1, y - 1) << '\n';
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  read();
  solve();
  print();
  return 0;
}
