#include <bits/stdc++.h>
using namespace std;
template <class T>
class SegmentTree {
 private:
  vector<T> data;

 public:
  SegmentTree() : SegmentTree(vector<T>()) {}
  SegmentTree(int n) : SegmentTree(vector<T>(n, 0)) {}
  SegmentTree(vector<T> data_) { data = data_; }
  void set(int idx, T new_value) { data[idx] = new_value; }
  T get(int idx) { return data[idx]; }
  T sum(int l, int r) {
    T ans = T();
    for (int i = l; i < r; i++) ans = ans + data[i];
    return ans;
  }
};
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);
  return (s1 - s2) % 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() {
  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;
}
