#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 1e6 + 500;
const long long inf = 1e18 + 800;
const long long mod = 1e9 + 7;
long long a[maxn];
long long w[maxn];
long long n;
long long fenw[maxn];
long long fenc[maxn];
void update_fenw(long long p, long long v) {
  for (p++; p < maxn; p += (p & (-p))) {
    fenw[p] += v;
  }
}
long long sum_fenw(long long p) {
  long long ans = 0;
  for (p++; p; p -= (p & (-p))) {
    ans += fenw[p];
  }
  return ans;
}
void update_fenc(long long p, long long v) {
  for (p++; p < maxn; p += (p & (-p))) {
    fenc[p] += v;
    fenc[p] %= mod;
  }
}
long long sum_fenc(long long p) {
  long long ans = 0;
  for (p++; p; p -= (p & (-p))) {
    ans += fenc[p];
    ans %= mod;
  }
  return ans;
}
long long find_best(long long v) {
  long long p = 0;
  for (long long i = 18; i >= 0; i--) {
    if (fenw[p + (1 << i)] <= v) {
      p += (1 << i);
      v -= fenw[p];
    }
  }
  return min(n - 2, p);
}
void update(long long id, long long val) {
  update_fenw(id, val - w[id]);
  update_fenc(id, (val - w[id]) * a[id]);
  w[id] = val;
}
long long find_res(long long l, long long r, long long y) {
  if (y < l || y > r) {
    return 0;
  }
  long long ans = 0;
  ans -= sum_fenc(y - 1) - sum_fenc(l - 1);
  ans += sum_fenc(r) - sum_fenc(y);
  ans += a[y] * (sum_fenw(y - 1) - sum_fenw(l - 1));
  ans -= a[y] * (sum_fenw(r) - sum_fenw(y));
  ans %= mod;
  ans += mod;
  ans %= mod;
  return ans;
}
long long find_ans(long long l, long long r) {
  long long a = sum_fenw(r);
  long long b = sum_fenw(l - 1);
  long long v = b + a / 2;
  long long p = find_best(v);
  long long H = 2 * sum_fenw(p) - sum_fenw(l - 1) - sum_fenw(r);
  if (H < 0 && p < r) p++;
  return find_res(l, r, p);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long q;
  cin >> n >> q;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = a[i] - i;
  }
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    update(i, x);
  }
  while (q--) {
    long long x, y;
    cin >> x >> y;
    if (x < 0) {
      long long id = -x;
      id--;
      update(id, y);
    } else {
      long long l = x - 1;
      long long r = y - 1;
      long long ans = find_ans(l, r);
      cout << ans << endl;
    }
  }
}
