#include <bits/stdc++.h>
using namespace std;
template <class T>
class SegmentTree {
 private:
  vector<T> tree;
  vector<T> data;
  int N;
  inline T OP(T x, T y) { return x + y; }
  T count_sum(int tv, int tl, int tr, int l, int r) {
    if (tl >= tr) return T();
    l = max(l, tl);
    r = min(r, tr);
    if (l >= r) return T();
    if (l == tl && r == tr) return tree[tv];
    int tm = (tl + tr) / 2;
    return OP(count_sum(2 * tv, tl, tm, l, r),
              count_sum(2 * tv + 1, tm, tr, l, r));
  }
  void update_value(int tv, int tl, int tr, int idx, T new_val) {
    if (tl >= tr) return;
    if (tl == idx && tr == idx + 1) {
      tree[tv] = new_val;
      return;
    }
    int tm = (tl + tr) / 2;
    if (idx < tm)
      update_value(2 * tv, tl, tm, idx, new_val);
    else
      update_value(2 * tv + 1, tm, tr, idx, new_val);
    tree[tv] = OP(tree[2 * tv], tree[2 * tv + 1]);
  }
  T build(int tv, int tl, int tr) {
    if (tl >= tr) return T();
    if (tl + 1 == tr) return tree[tv] = data[tl];
    int tm = (tl + tr) / 2;
    return tree[tv] = OP(build(2 * tv, tl, tm), build(2 * tv + 1, tm, tr));
  }

 public:
  SegmentTree() : SegmentTree(vector<T>()) {}
  SegmentTree(int n) : SegmentTree(vector<T>(n)) {}
  SegmentTree(vector<T> data_) {
    data = data_;
    N = data.size();
    tree = vector<T>(4 * N);
    if (N > 0) build(1, 0, N);
  }
  void set(int idx, T new_value) {
    data[idx] = new_value;
    update_value(1, 0, N, idx, new_value);
  }
  T get(int idx) { return data[idx]; }
  T sum(int l, int r) { return count_sum(1, 0, N, max(0, l), min(N, r)); }
};
vector<int64_t> a, b;
SegmentTree<int64_t> w, wb;
int64_t find_ans(int l, int r) {
  int zl = l, zr = r, zm;
  while (zl + 1 != zr) {
    int zm = (zl + zr) / 2;
    int64_t SL = w.sum(l, zm);
    int64_t SR = w.sum(zm, r);
    if (SL - SR <= 0)
      zl = zm;
    else
      zr = zm;
  }
  int z = zl;
  int64_t s1 = (b[z] * (w.sum(l, z) - w.sum(z, r))) % 1000000007;
  int64_t s2 = (wb.sum(l, z) - wb.sum(z, r)) % 1000000007;
  return ((s1 - s2) % 1000000007 + 1000000007) % 1000000007;
}
vector<int64_t> read_vector(int n) {
  vector<int64_t> ans(n);
  for (int i = 0; i < n; i++) cin >> ans[i];
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  a = read_vector(n);
  w = SegmentTree<int64_t>(read_vector(n));
  b = vector<int64_t>(n);
  wb = SegmentTree<int64_t>(n);
  for (int i = 0; i < n; i++) {
    b[i] = a[i] - i;
    wb.set(i, (w.get(i) * b[i]) % 1000000007);
  }
  for (int i = 0; i < q; i++) {
    int64_t x, y;
    cin >> x >> y;
    if (x < 0) {
      int idx = (-x) - 1;
      w.set(idx, y);
      wb.set(idx, (y * b[idx]) % 1000000007);
    } else {
      cout << find_ans(x - 1, y) << "\n";
    }
  }
  return 0;
}
