#include <bits/stdc++.h>
using namespace std;
long long int n, m, a[1000005];
long long int w[1000005];
long long int bit1[1000005];
long long int bit2[1000005];
void upd(long long int idx, long long int val, long long int bit[]) {
  for (; idx < 1000005; idx += idx & -idx) bit[idx] += val;
}
long long int qry(long long int idx, long long int bit[]) {
  long long int ans = 0;
  for (; idx > 0; idx -= idx & -idx) ans += bit[idx];
  return ans;
}
long long int inline mul(long long int a, long long int b) {
  a %= 1000000007;
  b %= 1000000007;
  if (a < 0) a += 1000000007;
  if (b < 0) b += 1000000007;
  a *= b;
  a %= 1000000007;
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int q;
  cin >> n >> q;
  for (long long int i = 1; i <= n; i++) cin >> a[i], a[i] -= i;
  for (long long int i = 1; i <= n; i++) cin >> w[i];
  for (long long int i = 1; i <= n; i++) {
    upd(i, mul(w[i], a[i]), bit1);
    upd(i, w[i], bit2);
  }
  for (long long int i = 1; i <= q; i++) {
    long long int l, r;
    cin >> l >> r;
    if (l < 0) {
      l = -l;
      upd(l, -1LL * mul(w[l], a[l]), bit1);
      upd(l, -1LL * w[l], bit2);
      w[l] = r;
      upd(l, mul(w[l], a[l]), bit1);
      upd(l, w[l], bit2);
    } else {
      long long int lo = l;
      long long int hi = r;
      long long int mid = l;
      long long int sm = qry(r, bit2) - qry(l - 1, bit2);
      while (lo <= hi) {
        long long int m = (lo + hi) / 2;
        if (2 * (qry(m - 1, bit2) - qry(l - 1, bit2)) <= sm)
          lo = m + 1, mid = m;
        else
          hi = m - 1;
      }
      long long int ans = mul((qry(mid, bit2) - qry(l - 1, bit2)), a[mid]) -
                          (qry(mid, bit1) - qry(l - 1, bit1)) % 1000000007;
      ans %= 1000000007;
      if (ans < 0) ans += 1000000007;
      long long int ans2 = mul((qry(r, bit2) - qry(mid, bit2)), a[mid]) -
                           (qry(r, bit1) - qry(mid, bit1)) % 1000000007;
      ans2 %= 1000000007;
      ans2 += 1000000007;
      ans2 %= 1000000007;
      ans -= ans2;
      ans %= 1000000007;
      ans += 1000000007;
      ans %= 1000000007;
      cout << ans << '\n';
    }
  }
  return 0;
}
