#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
class fenwick_tree {
  const int n;
  vector<T> data;

 public:
  fenwick_tree(int n_) : n(n_), data(n + 1) {}
  T find(int p) const {
    T res = 0;
    while (p > 0) {
      res += data[p];
      p -= p & -p;
    }
    return res;
  }
  T find(int l, int r) const { return find(r) - find(l); }
  void add(int p, T val) {
    ++p;
    while (p <= n) {
      data[p] += val;
      p += p & -p;
    }
  }
  void update(int p, T val) { add(p, val - find(p, p + 1)); }
};
template <int MOD>
class mod_int {
  unsigned x;

 public:
  mod_int() : x(0) {}
  mod_int(int sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  mod_int(long long sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  int get() const { return (int)x; }
  mod_int &operator+=(mod_int that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  mod_int &operator-=(mod_int that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  mod_int &operator*=(mod_int that) {
    x = (unsigned long long)x * that.x % MOD;
    return *this;
  }
  mod_int &operator/=(mod_int that) { return *this *= that.inverse(); }
  mod_int operator+(mod_int that) const { return mod_int(*this) += that; }
  mod_int operator-(mod_int that) const { return mod_int(*this) -= that; }
  mod_int operator*(mod_int that) const { return mod_int(*this) *= that; }
  mod_int operator/(mod_int that) const { return mod_int(*this) /= that; }
  bool operator==(const mod_int &that) const { return x == that.x; }
  mod_int inverse() const {
    long long a = x, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return mod_int(u);
  }
};
const int mod = 1e9 + 7;
using mint = mod_int<mod>;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  fenwick_tree<ll> co(n);
  fenwick_tree<mint> all(n);
  for (int i = 0; i < n; i++) {
    int w;
    cin >> w;
    co.add(i, w);
    all.add(i, mint(1) * w * a[i]);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      int id = -x - 1;
      co.update(id, y);
      all.update(id, mint(1) * y * a[id]);
    } else {
      --x;
      ll sum = co.find(x, y);
      int lb = x, ub = y;
      while (ub - lb > 1) {
        int m = (lb + ub) / 2;
        (co.find(x, m) * 2 <= sum ? lb : ub) = m;
      }
      mint pos = a[lb];
      ll lc = co.find(x, lb), rc = sum - lc;
      mint res = (pos * lc - all.find(x, lb)) + (all.find(lb, y) - pos * rc);
      printf("%d\n", res.get());
    }
  }
  return 0;
}
