#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
const long long mod = 1e9 + 7;
long long n, q;
long long a[N], w[N];
template <typename T>
inline void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
inline void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
inline void read(T &x) {
  T f = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  x *= f;
}
inline void inc(long long &x, long long y) {
  x = x + y < mod ? x + y : x + y - mod;
}
inline void dec(long long &x, long long y) {
  x = x - y >= 0 ? x - y : x - y + mod;
}
struct B1 {
  long long c[N];
  inline long long lowbit(long long x) { return x & (-x); }
  inline void mdf(long long x, long long val) {
    for (long long i = x; i <= n; i += lowbit(i)) c[i] += val;
  }
  inline long long qry(long long x) {
    long long ret = 0;
    for (long long i = x; i >= 1; i -= lowbit(i)) ret += c[i];
    return ret;
  }
  inline long long qry(long long l, long long r) {
    if (l > r) return 0;
    return qry(r) - qry(l - 1);
  }
} BitSum;
struct B2 {
  long long c[N];
  inline long long lowbit(long long x) { return x & (-x); }
  inline void mdf(long long x, long long val) {
    val = (val % mod + mod) % mod;
    for (long long i = x; i <= n; i += lowbit(i)) inc(c[i], val);
  }
  inline long long qry(long long x) {
    long long ret = 0;
    for (long long i = x; i >= 1; i -= lowbit(i)) inc(ret, c[i]);
    return ret;
  }
  inline long long qry(long long l, long long r) {
    if (l > r) return 0;
    long long ret = qry(r);
    dec(ret, qry(l - 1));
    return ret;
  }
} BitMul;
inline long long getPos(long long x, long long y) {
  long long ln = x, rn = y, mid, res = 0;
  for (; ln <= rn;) {
    mid = (ln + rn) / 2;
    if (BitSum.qry(x, mid) >= BitSum.qry(mid + 1, y))
      res = mid, rn = mid - 1;
    else
      ln = mid + 1;
  }
  return res;
}
inline void solve(long long x, long long y) {
  if (x == y) {
    puts("0");
    return;
  }
  long long pos = getPos(x, y);
  long long res = 0LL;
  res = (-BitMul.qry(x, pos) +
         (BitSum.qry(x, pos) % mod) * abs(a[pos] - pos) % mod + mod) %
        mod;
  res = (res - (BitSum.qry(pos, y)) % mod * abs(a[pos] - pos) % mod +
         BitMul.qry(pos, y) + mod) %
        mod;
  printf("%lld\n", (res % mod + mod) % mod);
}
signed main() {
  read(n), read(q);
  for (long long i = 1; i <= n; ++i) read(a[i]);
  for (long long i = 1; i <= n; ++i) {
    read(w[i]);
    BitMul.mdf(i, 1LL * w[i] * (a[i] - i));
    BitSum.mdf(i, w[i]);
  }
  while (q--) {
    long long x, y;
    read(x), read(y);
    if (x < 0) {
      x = -x;
      BitSum.mdf(x, -w[x]);
      BitMul.mdf(x, -1LL * w[x] * (a[x] - x));
      w[x] = 1LL * y;
      BitSum.mdf(x, w[x]);
      BitMul.mdf(x, 1LL * w[x] * (a[x] - x));
    } else
      solve(x, y);
  }
  return 0;
}
