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