#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool smin(T &a, const T &b) {
  return a > b ? a = b : a;
}
template <typename T>
inline bool smax(T &a, const T &b) {
  return a < b ? a = b : a;
}
const long long N = (long long)2e5 + 5, mod = (long long)1e9 + 7;
long long query(long long m, long long *f, long long dont = 0) {
  ++m;
  long long res = 0;
  while (m > 0) {
    res += f[m];
    m -= m & -m;
    if (dont == 0)
      while (res >= mod) res -= mod;
  }
  return res;
}
long long query(long long l, long long r, long long *f, long long dont = 0) {
  return (query(r - 1, f, dont) - query(l - 1, f, dont) + mod) % mod;
}
void update(long long m, long long first, long long *f, long long dont = 0) {
  ++m;
  while (m < N) {
    f[m] = (f[m] + first);
    if (dont == 0) f[m] %= mod;
    m += m & -m;
  }
}
long long f[N], a[N], w[N], qf[N];
int32_t main() {
  long long n, q;
  cin >> n >> q;
  for (long long j = 0; j < n; ++j) {
    cin >> a[j];
    a[j] -= j;
  }
  for (long long j = 0; j < n; ++j) {
    cin >> w[j];
    update(j, w[j], f, 1);
    update(j, (long long)a[j] * w[j] % mod, qf);
  }
  while (q--) {
    long long pos, nw;
    cin >> pos >> nw;
    if (pos < 0) {
      pos = -pos;
      --pos;
      update(pos, (nw - w[pos] + mod) % mod, f, 1);
      update(pos, (nw - w[pos] + mod) * (long long)a[pos] % mod, qf);
      w[pos] = nw;
    } else {
      long long l = pos, r = nw;
      --l;
      long long bl = l, br = r;
      long long sum_all = query(l, r, f, 1);
      while (bl < br - 1) {
        long long bm = bl + br >> 1;
        if (query(l, bm, f, 1) * 2 > sum_all) {
          br = bm;
        } else {
          bl = bm;
        }
      }
      long long res =
          (a[bl] * (long long)query(l, bl, f) - query(l, bl, qf) + mod) % mod +
          ((mod - a[bl]) * (long long)query(bl, r, f) + query(bl, r, qf)) % mod;
      res %= mod;
      cout << res << '\n';
    }
  }
}
