#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
template <typename T>
void uin(T &a, T b) {
  if (b < a) a = b;
}
template <typename T>
void uax(T &a, T b) {
  if (b > a) a = b;
}
const long long maxn = 200 * 1000 + 228, mod = 1e9 + 7;
long long a[maxn], w[maxn], ps[maxn];
long long n, q;
struct node {
  long long sw, saw;
  long long l, r;
  node() { sw = saw = l = r = 0; }
};
vector<node> d;
long long addi(long long a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
void build(long long l, long long r, long long v = 1) {
  d[v].l = l;
  d[v].r = r;
  if (l == r) {
    d[v].saw = (a[l] * w[l]) % mod;
    d[v].sw = w[l];
    ps[l] = v;
  } else {
    long long m = (l + r) >> 1;
    build(l, m, v << 1);
    build(m + 1, r, v << 1 | 1);
    d[v].saw = addi(d[v << 1].saw, d[v << 1 | 1].saw);
    d[v].sw = d[v << 1].sw + d[v << 1 | 1].sw;
  }
}
void init(long long _n) {
  long long ss = 1;
  while (ss < _n) {
    ss <<= 1;
  }
  ss <<= 1;
  d.resize(ss + 7, node());
  build(1, _n);
}
void update(long long pos, long long nw) {
  long long v = ps[pos];
  w[pos] = nw;
  d[v].saw = (a[pos] * w[pos]) % mod;
  d[v].sw = w[pos];
  v >>= 1;
  while (v) {
    d[v].saw = addi(d[v << 1].saw, d[v << 1 | 1].saw);
    d[v].sw = d[v << 1].sw + d[v << 1 | 1].sw;
    v >>= 1;
  }
}
long long getw(long long l, long long r, long long v = 1) {
  if (l > r || d[v].l > r || d[v].r < l) {
    return 0;
  }
  if (l <= d[v].l && d[v].r <= r) {
    return d[v].sw;
  }
  return getw(l, r, v << 1) + getw(l, r, v << 1 | 1);
}
long long getsaw(long long l, long long r, long long v = 1) {
  if (l > r || d[v].l > r || d[v].r < l) {
    return 0;
  }
  if (l <= d[v].l && d[v].r <= r) {
    return d[v].saw;
  }
  return (getsaw(l, r, v << 1) + getsaw(l, r, v << 1 | 1)) % mod;
}
long long getr(long long l, long long r) {
  long long S = getw(l, r);
  long long left228 = l, right228 = r + 1;
  while (right228 - left228 > 1) {
    long long mid = (left228 + right228) >> 1;
    long long sm = getw(l, mid - 1);
    if (2 * sm <= S) {
      left228 = mid;
    } else {
      right228 = mid;
    }
  }
  return left228;
}
void solve1(long long i, long long x) { update(i, x); }
long long solve2(long long l, long long r) {
  long long k = getr(l, r);
  long long res = 0;
  res += ((a[k] * getw(l, k - 1)) % mod - (getsaw(l, k - 1)) % mod + mod) % mod;
  res -= ((a[k] * getw(k + 1, r)) % mod - getsaw(k + 1, r) % mod + mod) % mod;
  res += 2 * mod;
  res %= mod;
  return res;
}
void solve() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  for (long long i = 1; i <= (long long)n; ++i) {
    cin >> a[i];
    a[i] -= i;
  }
  for (long long i = 1; i <= (long long)n; ++i) {
    cin >> w[i];
  }
  init(n);
  for (long long iter = 1; iter <= (long long)q; ++iter) {
    long long x, y;
    cin >> x >> y;
    if (x < 0) {
      long long id = -x;
      long long nw = y;
      solve1(id, nw);
    } else {
      long long l = x, r = y;
      cout << solve2(l, r) << '\n';
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
