#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000 * 1000 * 1000 + 7;
const long long nax = 200005;
struct fenwick_tree_1D {
  long long n, log_n;
  vector<long long> tree;
  fenwick_tree_1D(long long _n)
      : n(_n), log_n((long long)(log2(_n) + 1.0L)), tree(_n + 5) {}
  void update(long long x, long long v) {
    while (x <= n) {
      tree[x] += v;
      x += x & (-x);
    }
  }
  long long prefix_sum(long long x) {
    long long r = 0;
    while (x) {
      r += tree[x];
      x -= x & (-x);
    }
    return r;
  }
  long long range_sum(long long l, long long r) {
    if (l > r) return 0;
    return prefix_sum(r) - prefix_sum(l - 1);
  }
  long long lower_bound(long long v) {
    long long b = 0, s = 0;
    for (long long i = log_n; i >= 0; i--)
      if ((b | (1LL << i)) <= n && s + tree[b | (1LL << i)] < v)
        s += tree[b | (1LL << i)], b |= (1LL << i);
    return (b != n) ? (b + 1) : (1LL << 62);
  }
};
fenwick_tree_1D weights(nax), prefix(nax), suffix(nax);
long long n, q;
long long a[nax] = {0}, w[nax] = {0}, p[nax] = {0}, s[nax] = {0};
void update(long long x, long long y) {
  weights.update(x, y - w[x]);
  w[x] = y;
  prefix.update(x, ((a[x] + n - x + 1) * y - p[x] + mod) % mod);
  p[x] = ((a[x] + n - x + 1) * y) % mod;
  suffix.update(x, ((a[x] + x) * y - s[x] + mod) % mod);
  s[x] = ((a[x] + x) * y) % mod;
}
long long query(long long l, long long r) {
  long long totalWeight = weights.range_sum(l, r);
  long long median = weights.prefix_sum(l - 1) + (totalWeight + 1) / 2;
  long long medianPosition = weights.lower_bound(median);
  long long leftWeight = weights.range_sum(l, medianPosition) % mod;
  long long rightWeight = weights.range_sum(medianPosition + 1, r) % mod;
  long long leftSum =
      (((a[medianPosition] + n - medianPosition + 1) * leftWeight) % mod) -
      (prefix.range_sum(l, medianPosition) % mod);
  leftSum += mod;
  leftSum %= mod;
  long long rightSum =
      (prefix.range_sum(medianPosition + 1, r) % mod) -
      (((a[medianPosition] + n - medianPosition + 1) * rightWeight) % mod);
  rightSum += mod;
  rightSum %= mod;
  return (leftSum + rightSum) % mod;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    update(i, x);
  }
  while (q--) {
    long long x, y;
    cin >> x >> y;
    if (x < 0)
      update(-1 * x, y);
    else
      cout << query(x, y) << "\n";
  }
}
