#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
const int M = 1e9 + 7;
int a[N];
int w[N];
int add(int a, int b) { return (a += b) < M ? a : a - M; }
int sub(int a, int b) { return (a -= b) < 0 ? a + M : a; }
int mul(int a, int b) { return 1LL * a * b % M; }
template <class T>
struct fenwick_tree {
  T tree[N];
  void update(int a, T val) {
    for (; a < N; a += a & -a) {
      tree[a] += val;
    }
  }
  T query(int a) {
    T res = 0;
    for (; a; a -= a & -a) {
      res += tree[a];
    }
    return res;
  }
  T query(int a, int b) { return query(b) - query(a - 1); }
};
fenwick_tree<long long> ft_cnt;
fenwick_tree<long long> ft_sum;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
    ft_cnt.update(i, w[i]);
    ft_sum.update(i, w[i] * a[i]);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      int delta = y - w[x];
      ft_cnt.update(x, delta);
      ft_sum.update(x, 1LL * delta * a[x]);
      w[x] = y;
    } else {
      int lo = x;
      int hi = y;
      long long target = (ft_cnt.query(x, y) + 1) / 2;
      while (lo <= hi) {
        int mid = (lo + hi) / 2;
        if (ft_cnt.query(x, mid) < target) {
          lo = mid + 1;
        } else {
          hi = mid - 1;
        }
      }
      cout << add(sub(mul(a[lo], ft_cnt.query(x, lo) % M),
                      ft_sum.query(x, lo) % M),
                  sub(ft_sum.query(lo + 1, y) % M,
                      mul(a[lo], ft_cnt.query(lo + 1, y) % M)))
           << "\n";
    }
  }
}
