#include <bits/stdc++.h>
using namespace std;
const int maxDataRange = 1e5 + 5;
const int mod = 1e9 + 7;
long long sumValue[maxDataRange << 2], valOfCal[maxDataRange << 2];
long long val[maxDataRange], pos[maxDataRange];
void updata(int rt) {
  sumValue[rt] = (sumValue[rt << 1] + sumValue[rt << 1 | 1]);
  valOfCal[rt] = (valOfCal[rt << 1] + valOfCal[rt << 1 | 1]) % mod;
}
void build(int l, int r, int rt) {
  if (l == r) {
    sumValue[rt] = val[l];
    valOfCal[rt] = val[l] * (l - pos[l]) % mod;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  updata(rt);
}
void modify(int l, int r, int rt, int p, long long v) {
  if (l == r) {
    sumValue[rt] = v;
    valOfCal[rt] = v * (l - pos[l]) % mod;
    return;
  }
  int mid = (l + r) >> 1;
  if (p <= mid)
    modify(l, mid, rt << 1, p, v);
  else
    modify(mid + 1, r, rt << 1 | 1, p, v);
  updata(rt);
  return;
}
long long cal(int l, int r, int rt, int nl, int nr, long long v) {
  if (nl > nr) return 0ll;
  if (nl <= l && nr >= r) {
    return (sumValue[rt] % mod * (v) + valOfCal[rt]) % mod;
  }
  int mid = (l + r) >> 1;
  long long tans = 0ll;
  if (nl <= mid) tans += cal(l, mid, rt << 1, nl, nr, v);
  if (nr > mid) tans += cal(mid + 1, r, rt << 1 | 1, nl, nr, v);
  return tans % mod;
}
long long getsum(int l, int r, int rt, int nl, int nr) {
  if (nl > nr) return 0ll;
  if (nl <= l && nr >= r) return sumValue[rt];
  int mid = (l + r) >> 1;
  long long tans = 0;
  if (nl <= mid) tans += getsum(l, mid, rt << 1, nl, nr);
  if (nr > mid) tans += getsum(mid + 1, r, rt << 1 | 1, nl, nr);
  return tans;
}
int findpos(int l, int r, int rt, int nl, int nr, long long pre,
            long long sum) {
  if (l == r) return l;
  int mid = (l + r) >> 1;
  if (nr <= mid) return findpos(l, mid, rt << 1, nl, nr, pre, sum);
  if (nl > mid)
    return findpos(mid + 1, r, rt << 1 | 1, nl, nr, pre - sumValue[rt << 1],
                   sum);
  long long lsum = sumValue[rt << 1] - pre, rsum = sum - lsum;
  if (lsum >= rsum)
    return findpos(l, mid, rt << 1, nl, nr, pre, sum);
  else
    return findpos(mid + 1, r, rt << 1 | 1, nl, nr, -lsum, sum);
}
int n, q;
long long solve(int l, int r) {
  int p =
      findpos(1, n, 1, l, r, getsum(1, n, 1, 1, l - 1), getsum(1, n, 1, l, r));
  printf("p=%d\n", p);
  return cal(1, n, 1, l, p - 1, pos[p] - p) -
         cal(1, n, 1, p + 1, r, pos[p] - p);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &pos[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &val[i]);
  }
  build(1, n, 1);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      modify(1, n, 1, -l, r);
    } else {
      printf("%lld\n", (solve(l, r) % mod + mod) % mod);
    }
  }
}
