#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int norm(int a) {
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
int norm(const long long &a) { return norm(int(a % mod)); }
long long mul(long long a, long long n) { return ((a * n) % mod); }
void inc(vector<long long> &f, int pos, long long val) {
  int N = (int)f.size();
  for (; pos < N; pos |= pos + 1) f[pos] += val;
}
long long sum(vector<long long> &f, int pos) {
  long long ans = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1) ans += f[pos];
  return ans;
}
long long getSum(vector<long long> &f, int l, int r) {
  return sum(f, r - 1) - sum(f, l - 1);
}
long long getNSum(vector<long long> &f, int l, int r) {
  return norm(sum(f, r - 1) - sum(f, l - 1));
}
int main() {
  int n, q;
  cin >> n >> q;
  vector<long long> a(n), w(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> w[i];
  vector<long long> fn(n + 1), fnW(n + 1);
  for (int i = 0; i < n; i++) {
    a[i] -= i;
    inc(fn, i, w[i]);
    inc(fnW, i, mul(a[i], w[i]));
  }
  for (int t = 0; t < q; t++) {
    int first, second;
    cin >> first >> second;
    if (first < 0) {
      first = -first - 1;
      inc(fn, first, -w[first]);
      inc(fnW, first, -mul(a[first], w[first]));
      w[first] = second;
      inc(fn, first, w[first]);
      inc(fnW, first, mul(a[first], w[first]));
      continue;
    }
    first--;
    long long sum = getSum(fn, first, second);
    int left = first, right = second;
    while (right - left > 1) {
      int mid = left + (right - left) / 2;
      if (2 * getSum(fn, first, mid) > sum)
        right = mid;
      else
        left = mid;
    }
    int ans = norm(mul(a[left], getNSum(fn, first, left)) -
                   getNSum(fnW, first, left));
    ans = norm(ans + norm(getNSum(fnW, left, second) -
                          mul(a[left], getNSum(fn, left, second))));
    cout << ans << endl;
  }
  return 0;
}
