#include <bits/stdc++.h>
const long long mod = 1000000007;
struct Segment_Tree {
  long long val, s;
} tree[1000100];
long long w[200100], a[200100], n, Q, x, y;
void build(long long t, long long l, long long r) {
  if (l == r) {
    tree[t].val = w[l];
    tree[t].s = a[l] * w[l] % mod;
    return;
  }
  long long mid = (l + r) / 2;
  build(t * 2, l, mid);
  build(t * 2 + 1, mid + 1, r);
  tree[t].val = tree[t * 2].val + tree[t * 2 + 1].val;
  tree[t].s = (tree[t * 2].s + tree[t * 2 + 1].s) % mod;
}
void modify(long long t, long long l, long long r, long long pos,
            long long val) {
  if (l == r) {
    w[l] = val;
    tree[t].val = w[l];
    tree[t].s = a[l] * w[l] % mod;
    return;
  }
  long long mid = (l + r) / 2;
  if (pos <= mid)
    modify(t * 2, l, mid, pos, val);
  else
    modify(t * 2 + 1, mid + 1, r, pos, val);
  tree[t].val = (tree[t * 2].val + tree[t * 2 + 1].val) % mod;
  tree[t].s = (tree[t * 2].s + tree[t * 2 + 1].s) % mod;
}
long long queryval(long long t, long long l, long long r, long long L,
                   long long R) {
  if (L > r || l > R) return 0;
  if (L <= l && r <= R) return tree[t].val;
  long long mid = (l + r) / 2;
  return queryval(t * 2, l, mid, L, R) + queryval(t * 2 + 1, mid + 1, r, L, R);
}
long long querys(long long t, long long l, long long r, long long L,
                 long long R) {
  if (L > r || l > R) return 0;
  if (L <= l && r <= R) return tree[t].s;
  long long mid = (l + r) / 2;
  return querys(t * 2, l, mid, L, R) + querys(t * 2 + 1, mid + 1, r, L, R);
}
void solve(long long l, long long r) {
  long long L = l, R = r, pos;
  while (L <= R) {
    long long mid = (L + R) / 2;
    if (queryval(1, 1, n, l, mid) >= queryval(1, 1, n, mid + 1, r))
      R = mid - 1, pos = mid;
    else
      L = mid + 1;
  }
  long long res = 0;
  res = (-querys(1, 1, n, l, pos) +
         queryval(1, 1, n, l, pos) % mod * a[pos] % mod + mod) %
        mod;
  res = (res - queryval(1, 1, n, pos, r) % mod * a[pos] % mod +
         querys(1, 1, n, pos, r) + mod) %
        mod;
  printf("%lld\n", res);
}
signed main() {
  scanf("%lld%lld", &n, &Q);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]), a[i] -= i;
  for (long long i = 1; i <= n; i++) scanf("%lld", &w[i]);
  build(1, 1, n);
  while (Q--) {
    scanf("%lld%lld", &x, &y);
    if (x < 0)
      modify(1, 1, n, -x, y);
    else
      solve(x, y);
  }
}
