#include <bits/stdc++.h>
using namespace std;
const int N = 210005, p = 1000000007;
int read() {
  int f = 1, g = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) g = g * 10 + ch - '0';
  return f * g;
}
int n, q;
long long a[N], w[N];
struct node {
  int l, r;
  long long s, sl, sr;
};
node operator+(node x, node y) {
  node z;
  z.l = x.l;
  z.r = y.r;
  z.s = x.s + y.s;
  z.sl = (x.sl + y.sl + y.s * (a[y.l] - a[x.l] - x.r + x.l - 1) % p) % p;
  z.sr = (x.sr + y.sr + x.s * (a[y.r] - y.r + y.l - 1 - a[x.r]) % p) % p;
  return z;
}
struct segment_tree {
  node a[N << 2];
  void build(int x, int fl, int fr) {
    a[x].l = fl;
    a[x].r = fr;
    if (fl == fr) {
      a[x].s = w[fl];
      return;
    }
    int mid = (fl + fr) >> 1;
    build(x * 2, fl, mid);
    build(x * 2 + 1, mid + 1, fr);
    a[x] = a[x * 2] + a[x * 2 + 1];
  }
  void modify(int x, int k, long long w) {
    if (a[x].l == a[x].r) {
      a[x].s = w;
      return;
    }
    int mid = (a[x].l + a[x].r) >> 1;
    modify(x * 2 + (k > mid), k, w);
    a[x] = a[x * 2] + a[x * 2 + 1];
  }
  long long getsum(int x, int k) {
    if (a[x].r <= k) return a[x].s;
    int mid = (a[x].l + a[x].r) >> 1;
    long long s = getsum(x * 2, k);
    if (mid < k) s += getsum(x * 2 + 1, k);
    return s;
  }
  int find(int x, long long k) {
    if (a[x].l == a[x].r) return a[x].l;
    int mid = (a[x].l + a[x].r) >> 1;
    if (k <= a[x * 2].s)
      return find(x * 2, k);
    else
      return find(x * 2 + 1, k - a[x * 2].s);
  }
  int lower_bound(long long k) { return find(1, k); }
  node query(int x, int l, int r) {
    if ((l <= a[x].l) && (a[x].r <= r)) return a[x];
    int mid = (a[x].l + a[x].r) >> 1;
    if (r <= mid)
      return query(x * 2, l, r);
    else if (mid < l)
      return query(x * 2 + 1, l, r);
    else
      return query(x * 2, l, r) + query(x * 2 + 1, l, r);
  }
  long long calc(int l, int r) {
    int t = lower_bound((getsum(1, l - 1) + getsum(1, r) + 1) >> 1);
    return (query(1, l, t).sr + query(1, t, r).sl) % p;
  }
} f;
int main() {
  n = read();
  q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) w[i] = read();
  a[0] = 0;
  a[n + 1] = 0x3f3f3f3f;
  f.build(1, 0, n + 1);
  while (q--) {
    int x = read(), y = read();
    if (x < 0)
      f.modify(1, -x, y);
    else
      printf("%d\n", f.calc(x, y));
  }
  return 0;
}
