#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 200, mod = 1e9 + 7;
int n, q, ai[MAX_N], bi[MAX_N], wi[MAX_N];
long long sum[MAX_N << 2], diff[MAX_N << 2];
void pushup(int p) {
  sum[p] = sum[(p << 1)] + sum[((p << 1) | 1)],
  diff[p] = (diff[(p << 1)] + diff[((p << 1) | 1)]) % mod;
}
void build(int l, int r, int p) {
  if (l == r) {
    sum[p] = wi[l], diff[p] = wi[l] * bi[l];
    return;
  }
  build(l, ((l + r) >> 1), (p << 1)),
      build(((l + r) >> 1) + 1, r, ((p << 1) | 1));
  pushup(p);
}
void update(int qx, int l, int r, int p) {
  if (l == r) {
    sum[p] = wi[l], diff[p] = wi[l] * bi[l];
    return;
  }
  if (qx <= ((l + r) >> 1))
    update(qx, l, ((l + r) >> 1), (p << 1));
  else
    update(qx, ((l + r) >> 1) + 1, r, ((p << 1) | 1));
  pushup(p);
}
long long query(int ql, int qr, int l, int r, int p, long long *nodes,
                bool opt = false) {
  if (ql > qr) return 0;
  if (ql <= l && r <= qr) return nodes[p];
  long long ret = 0;
  if (ql <= ((l + r) >> 1))
    ret += query(ql, qr, l, ((l + r) >> 1), (p << 1), nodes);
  if (((l + r) >> 1) < qr)
    ret += query(ql, qr, ((l + r) >> 1) + 1, r, ((p << 1) | 1), nodes);
  if (opt) ret %= mod;
  return ret;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &ai[i]), bi[i] = ai[i] - i;
  for (int i = 1; i <= n; i++) scanf("%d", &wi[i]);
  build(1, n, 1);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0)
      l = -l, wi[l] = r, update(l, 1, n, 1);
    else {
      int lb = l, rb = r, res = l;
      while (lb <= rb) {
        int mid = (lb + rb) >> 1;
        if (query(l, mid, 1, n, 1, sum) >= query(mid + 1, r, 1, n, 1, sum))
          res = mid, rb = mid - 1;
        else
          lb = mid + 1;
      }
      long long part1 =
          (1LL * query(l, res - 1, 1, n, 1, sum, true) * (ai[res] - res) % mod +
           mod - query(l, res - 1, 1, n, 1, diff, true)) %
          mod;
      long long part2 = (1LL * query(res + 1, r, 1, n, 1, sum, true) *
                             (res + mod - ai[res]) % mod +
                         query(res + 1, r, 1, n, 1, diff, true)) %
                        mod;
      printf("%lld\n", (0LL + part1 + part2) % mod);
    }
  }
  return 0;
}
