#include <bits/stdc++.h>
using int64 = long long;
constexpr int Maxn = 200000;
constexpr int p = 1000000007;
template <class _Tp1, class _Tp2>
inline void inc(_Tp1& x, const _Tp2& y) {
  x += y;
  (p <= x) && (x -= p);
}
template <class _Tp1, class _Tp2>
inline void dec(_Tp1& x, const _Tp2& y) {
  x -= y;
  (x < 0) && (x += p);
}
template <class _Tp>
inline int md(const _Tp& v) {
  return v < 0 ? ((0 <= p + v) ? (p + v) : (v % p + p)) : (v < p) ? v : (v % p);
}
namespace IOManager {
constexpr int FILESZ(131072);
unsigned char buf[FILESZ];
const unsigned char *ibuf = buf, *tbuf = buf;
struct IOManager {
  inline unsigned char gc() {
    return (ibuf == tbuf) &&
                   (tbuf = (ibuf = buf) + fread(buf, 1, FILESZ, stdin),
                    ibuf == tbuf)
               ? EOF
               : *ibuf++;
  }
  template <class _Tp>
  inline operator _Tp() {
    _Tp s = 0u;
    unsigned char c = gc(), w = 0;
    for (; c < 48; c = gc()) (c == 45) && (w = 1);
    for (; c > 47; c = gc()) s = (_Tp)(s * 10u + c - 48u);
    return w ? -s : s;
  }
};
}  // namespace IOManager
IOManager::IOManager io;
const int n = io;
int64 bit[Maxn + 1];
inline void update(const int& x, const int& d) {
  for (int i = x; i <= n; i += i & -i) bit[i] += d;
}
inline int64 sum(const int& x) {
  int64 s = 0;
  for (int i = x; i; i -= i & -i) s += bit[i];
  return s;
}
int bitp[Maxn + 1];
inline void updatep(const int& x, const int& d) {
  for (int i = x; i <= n; i += i & -i) inc(bitp[i], d);
}
inline int sump(const int& x) {
  int64 s = 0;
  for (int i = x; i; i -= i & -i) s += bitp[i];
  return s % p;
}
int a[Maxn + 1], w[Maxn + 1];
int main() {
  int q = io;
  for (int i = 1; i <= n; ++i) a[i] = (int)io - i;
  for (int i = 1; i <= n; ++i)
    w[i] = io, update(i, w[i]), updatep(i, (int64)w[i] * a[i] % p);
  int64 sl, sm, sr;
  for (int x, y, l, m, r; q; --q)
    if (x = io, y = io, x < 0) {
      int d = y - w[x = -x];
      w[x] = y;
      update(x, d);
      updatep(x, md((int64)d * a[x]));
    } else {
      l = x;
      r = y;
      sl = sum(l - 1);
      sr = sum(r) - sl;
      for (; l < r;)
        ((sum(m = (l + r) >> 1) - sl) * 2 < sr) ? (l = m + 1) : (r = m);
      sm = sum(m = l);
      sr += sl;
      printf("%d\n", md((int64)(sump(y) - sump(m) * 2ll +
                                (int64)(sm - sr + sm - sl) % p * a[m] % p +
                                sump(x - 1))));
    }
  return 0;
}
