#include <bits/stdc++.h>
using namespace std;
struct Node {
  long long w, lmt, rmt;
} tree[400000];
int pos[100000], n, q;
void update(int i, int w, int n = 1, int l = 0, int r = 100000) {
  if (l > i || r < i) return;
  if (l == r) {
    tree[n] = {w, 0, 0};
    return;
  }
  update(i, w, n * 2, l, (l + r) / 2);
  update(i, w, n * 2 + 1, (l + r) / 2 + 1, r);
  int lgap = pos[(l + r) / 2 + 1] - (pos[l] + (l + r) / 2 - l) - 1;
  int rgap = pos[r] - (r - ((l + r) / 2 + 1)) - pos[(l + r) / 2] - 1;
  tree[n].w = (tree[n * 2].w + tree[n * 2 + 1].w) % 1000000007;
  tree[n].lmt =
      (tree[n * 2].lmt + tree[n * 2 + 1].lmt + tree[n * 2 + 1].w * lgap) %
      1000000007;
  tree[n].rmt = (tree[n * 2].rmt + tree[n * 2 + 1].rmt + tree[n * 2].w * rgap) %
                1000000007;
}
Node get(int rl, int rr, int n = 1, int l = 0, int r = 100000) {
  if (l > rr || r < rl) return {0, 0, 0};
  if (l >= rl && r <= rr) return tree[n];
  Node ls = get(rl, rr, n * 2, l, (l + r) / 2);
  Node rs = get(rl, rr, n * 2 + 1, (l + r) / 2 + 1, r);
  if ((l + r) / 2 + 1 > rr) return ls;
  if ((l + r) / 2 < rl) return rs;
  int el = max(l, rl), er = min(r, rr);
  int lgap = pos[(el + er) / 2 + 1] - (pos[el] + (el + er) / 2 - el) - 1;
  int rgap = pos[er] - (er - ((el + er) / 2 + 1)) - pos[(el + er) / 2] - 1;
  return {(ls.w + rs.w) % 1000000007,
          (ls.lmt + rs.lmt + rs.w * lgap) % 1000000007,
          (ls.rmt + rs.rmt + ls.w * rgap) % 1000000007};
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> pos[i];
  for (int i = 0; i < n; i++) {
    int w;
    cin >> w;
    update(i, w);
  }
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = (-x) - 1;
      update(x, y);
    } else {
      x--;
      y--;
      int l = x, r = y;
      int high = r + 1, low = l;
      while (high - low > 1) {
        int mid = (high + low) / 2;
        if (get(l, mid).w > get(mid, r).w) {
          high = mid;
        } else
          low = mid;
      }
      int ans = get(l, low).rmt + get(low, r).lmt;
      cout << ans << endl;
    }
  }
}
