#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll mod = 1000000007;
struct modft {
  vector<ll> tree;
  void update(int i, ll val) {
    i++;
    while (i < (int)(tree).size()) {
      tree[i] += val;
      tree[i] %= mod;
      i += (i & (-i));
    }
  }
  modft(int n) { tree.assign(n + 1, 0); }
  ll prefix_sum(int i) {
    ll sum = 0;
    i++;
    while (i > 0) {
      sum += tree[i];
      sum %= mod;
      i -= (i & (-i));
    }
    return sum;
  }
  ll query(int l, int r) {
    --r;
    --l;
    ll res = prefix_sum(r);
    if (l >= 0) res -= prefix_sum(l);
    return ((res % mod) + mod) % mod;
  }
  void set(int i, ll val) {
    ll cur = query(i, i + 1);
    update(i, (((val - cur) % mod) + mod) % mod);
  }
};
struct ft {
  vector<ll> tree;
  void update(int i, ll val) {
    i++;
    while (i < (int)(tree).size()) {
      tree[i] += val;
      i += (i & (-i));
    }
  }
  ft(int n) { tree.assign(n + 1, 0); }
  ll prefix_sum(int i) {
    ll sum = 0;
    i++;
    while (i > 0) {
      sum += tree[i];
      i -= (i & (-i));
    }
    return sum;
  }
  ll query(int l, int r) {
    --r;
    --l;
    ll res = prefix_sum(r);
    if (l >= 0) res -= prefix_sum(l);
    return res;
  }
  void set(int i, ll val) {
    ll cur = query(i, i + 1);
    update(i, val - cur);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  vector<ll> a(n), w(n);
  ft raw(n);
  modft lin(n), space(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    raw.update(i, w[i]);
    lin.update(i, (i * w[i]) % mod);
    space.update(i, (a[i] * w[i]) % mod);
  }
  for (int _ = 0; _ < q; _++) {
    ll x, y;
    cin >> x >> y;
    if (x < 0) {
      int i = (int)(-x - 1);
      w[i] = y;
      raw.set(i, w[i]);
      lin.set(i, (i * w[i]) % mod);
      space.set(i, (a[i] * w[i]) % mod);
    } else {
      --x;
      int lo = (int)x;
      int hi = (int)y;
      ll sum = raw.query(lo, hi);
      while (hi - lo > 1) {
        int mid = (lo + hi) / 2;
        if (raw.query((int)x, mid) * 2 > sum) {
          hi = mid;
        } else {
          lo = mid;
        }
      }
      int _x = (int)x;
      int _y = (int)y;
      int k = lo;
      ll left = ((a[k] - k) * raw.query(_x, k)) % mod;
      left = (left - space.query(_x, k)) % mod;
      left = (left + lin.query(_x, k)) % mod;
      ll right = ((k - a[k]) * raw.query(k + 1, _y)) % mod;
      right = (right + space.query(k + 1, _y)) % mod;
      right = (right - lin.query(k + 1, _y)) % mod;
      ll ans = (((left + right) % mod) + mod) % mod;
      cout << ans << '\n';
    }
  }
}
