#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
struct State {
  long long sumw;
  int length;
  long long gor;
  long long gol;
};
State combine(const State &l, const State &r) {
  return {l.sumw + r.sumw, l.length + r.length,
          (l.gor + r.gor + r.length * l.sumw) % MOD,
          (l.gol + r.gol + l.length * r.sumw) % MOD};
}
struct Tree {
  const State ZERO = {0, 0, 0, 0};
  int n;
  vector<State> s;
  Tree() {}
  Tree(const vector<int> &b, const vector<long long> &w) {
    n = 1;
    int m = b.size();
    while (n < m) n *= 2;
    s.assign(n, ZERO);
    for (int i = 0; i < (m); ++i) {
      int distr = 0;
      if (i + 1 < m) distr = b[i + 1] - b[i];
      s.push_back(State{w[i], distr, w[i] * distr, 0LL});
    }
    s.resize(2 * n, ZERO);
    for (int i = n; i-- > 1;) s[i] = combine(s[i * 2], s[i * 2 + 1]);
  }
  void update(int pos, long long neww) {
    pos += n;
    s[pos].sumw = neww;
    s[pos].gor = s[pos].length * neww;
    for (pos /= 2; pos >= 1; pos /= 2)
      s[pos] = combine(s[pos * 2], s[pos * 2 + 1]);
  }
  State query(int l, int r) { return que(1, l, r, 0, n); }
  State que(int pos, int l, int r, int lo, int hi) {
    if (r <= lo || hi <= l) return ZERO;
    if (l <= lo && hi <= r) return s[pos];
    int m = (lo + hi) / 2;
    return combine(que(2 * pos, l, r, lo, m), que(2 * pos + 1, l, r, m, hi));
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  vector<int> b(n);
  vector<long long> w(n);
  for (int i = 0; i < (n); ++i) {
    cin >> b[i];
    b[i] -= i;
  }
  for (int i = 0; i < (n); ++i) cin >> w[i];
  Tree t(b, w);
  for (int i = 0; i < (q); ++i) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      --x;
      t.update(x, y);
    } else {
      int l = x - 1, r = y;
      long long sum = t.query(l, r).sumw;
      int lo = l, hi = r - 1;
      while (lo < hi) {
        int m = (lo + hi) / 2;
        if (t.query(l, m + 1).sumw * 2 >= sum)
          hi = m;
        else
          lo = m + 1;
      }
      int mid = lo;
      long long lres = t.query(l, mid).gor;
      long long rres = t.query(mid, r).gol;
      long long ans = (lres + rres) % MOD;
      cout << ans << "\n";
    }
  }
}
