#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int a[400020], w[400020];
int tot, ls[400020], rs[400020];
long long sumw[400020], sum[400020];
int n, q, rt;
inline void update(int x) {
  sum[x] = (sum[ls[x]] + sum[rs[x]]) % mod;
  sumw[x] = sumw[ls[x]] + sumw[rs[x]];
}
void build(int &x, int l, int r) {
  x = ++tot;
  if (l == r) {
    sumw[x] = w[l], sum[x] = (long long)a[l] * w[l] % mod;
    return;
  }
  int mid = (l + r) >> 1;
  build(ls[x], l, mid), build(rs[x], mid + 1, r);
  update(x);
}
void modify(int x, int l, int r, int id, int d) {
  if (l == r) {
    sumw[x] = d, sum[x] = (long long)a[l] * d % mod;
    return;
  }
  int mid = (l + r) >> 1;
  if (id <= mid)
    modify(ls[x], l, mid, id, d);
  else
    modify(rs[x], mid + 1, r, id, d);
  update(x);
}
long long queryw(int x, int l, int r, int L, int R) {
  if (L <= l && R >= r) return sumw[x];
  int mid = (l + r) >> 1;
  long long res = 0;
  if (L <= mid) res = queryw(ls[x], l, mid, L, R);
  if (R > mid) res += queryw(rs[x], mid + 1, r, L, R);
  return res;
}
long long querys(int x, int l, int r, int L, int R) {
  if (L <= l && R >= r) return sum[x];
  int mid = (l + r) >> 1;
  long long res = 0;
  if (L <= mid) res = querys(ls[x], l, mid, L, R);
  if (R > mid) res += querys(rs[x], mid + 1, r, L, R);
  return res % mod;
}
int queryid(int x, int l, int r, int L, int R, long long &D) {
  if (l == r) {
    D -= sumw[x];
    return D <= 0 ? l : 0;
  }
  int mid = (l + r) >> 1, res = 0;
  if (L <= l && R >= r) {
    if (D > sumw[x]) {
      D -= sumw[x];
      return 0;
    }
    if (D <= sumw[ls[x]]) return queryid(ls[x], l, mid, L, R, D);
    D -= sumw[ls[x]];
    return queryid(rs[x], mid + 1, r, L, R, D);
  }
  if (L <= mid) res = queryid(ls[x], l, mid, L, R, D);
  if (res || R <= mid) return res;
  return queryid(rs[x], mid + 1, r, L, R, D);
}
int main() {
  scanf("%d %d", &n, &q);
  for (register int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] = a[i] - i;
  for (register int i = 1; i <= n; i++) scanf("%d", &w[i]);
  build(rt, 1, n);
  while (q--) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x < 0) {
      modify(rt, 1, n, -x, y);
    } else {
      long long sumw = queryw(rt, 1, n, x, y), tmp = (sumw + 1) / 2;
      int id = queryid(rt, 1, n, x, y, tmp);
      long long w1 = queryw(rt, 1, n, x, id), w2 = sumw - w1;
      long long ans = (((long long)a[id] * w1 - querys(rt, 1, n, x, id) +
                        querys(rt, 1, n, id + 1, y) - (long long)a[id] * w2) %
                           mod +
                       mod) %
                      mod;
      printf("%lld\n", ans);
    }
  }
}
