#include <bits/stdc++.h>
using namespace std;
void qmax(long long &x, long long y) {
  if (x < y) x = y;
}
void qmin(long long &x, long long y) {
  if (x > y) x = y;
}
inline long long read() {
  char s;
  long long k = 0, base = 1;
  while ((s = getchar()) != '-' && s != EOF && !(isdigit(s)))
    ;
  if (s == EOF) exit(0);
  if (s == '-') base = -1, s = getchar();
  while (isdigit(s)) k = k * 10 + (s ^ '0'), s = getchar();
  return k * base;
}
inline void write(long long x) {
  static char cnt, num[15];
  cnt = 0;
  if (!x) {
    putchar('0');
    return;
  }
  for (; x; x /= 10) num[++cnt] = x % 10;
  for (; cnt; putchar(num[cnt--] + 48))
    ;
}
const long long mod = 1e9 + 7;
const long long maxn = 4e5 + 10;
long long a[maxn], w[maxn];
long long n, q;
long long h[maxn << 2];
long long dis[2][maxn << 2];
void Mod(long long &x) { x %= mod; }
void bt(long long x, long long y, long long d) {
  if (x == y) {
    dis[0][d] = w[x] * (a[x] - x) % mod;
    dis[1][d] = w[x] * (a[n] - (n - x) - a[x]) % mod;
    h[d] = w[x];
    return;
  }
  long long mid = (x + y) >> 1;
  bt(x, mid, d << 1);
  bt(mid + 1, y, d << 1 | 1);
  h[d] = h[d << 1] + h[d << 1 | 1];
  dis[0][d] = dis[0][d << 1] + dis[0][d << 1 | 1];
  Mod(dis[0][d]);
  dis[1][d] = dis[1][d << 1] + dis[1][d << 1 | 1];
  Mod(dis[1][d]);
}
long long qsum(long long x, long long y, long long d, long long l,
               long long r) {
  if (x == l && y == r) return h[d];
  long long mid = (x + y) >> 1;
  if (r <= mid) return qsum(x, mid, d << 1, l, r);
  if (l > mid) return qsum(mid + 1, y, d << 1 | 1, l, r);
  return qsum(x, mid, d << 1, l, mid) +
         qsum(mid + 1, y, d << 1 | 1, mid + 1, r);
}
long long kth(long long x, long long y, long long d, long long k) {
  if (x == y) return x;
  long long mid = (x + y) >> 1;
  if (h[d << 1] >= k) return kth(x, mid, d << 1, k);
  return kth(mid + 1, y, d << 1 | 1, k - h[d << 1]);
}
long long qdis(long long x, long long y, long long d, long long l, long long r,
               long long flag) {
  if (l == x && y == r) return dis[flag][d];
  long long mid = (x + y) >> 1;
  if (r <= mid) return qdis(x, mid, d << 1, l, r, flag);
  if (l > mid) return qdis(mid + 1, y, d << 1 | 1, l, r, flag);
  return (qdis(x, mid, d << 1, l, mid, flag) +
          qdis(mid + 1, y, d << 1 | 1, mid + 1, r, flag)) %
         mod;
}
void xg(long long x, long long y, long long d, long long p) {
  if (x == y) {
    dis[0][d] = w[x] * (a[x] - x) % mod;
    dis[1][d] = w[x] * (a[n] - (n - x) - a[x]) % mod;
    h[d] = w[x];
    return;
  }
  long long mid = (x + y) >> 1;
  if (p <= mid)
    xg(x, mid, d << 1, p);
  else
    xg(mid + 1, y, d << 1 | 1, p);
  h[d] = h[d << 1] + h[d << 1 | 1];
  dis[0][d] = dis[0][d << 1] + dis[0][d << 1 | 1];
  Mod(dis[0][d]);
  dis[1][d] = dis[1][d << 1] + dis[1][d << 1 | 1];
  Mod(dis[1][d]);
}
signed main() {
  n = read(), q = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= n; i++) w[i] = read();
  bt(1, n, 1);
  long long x, y, p;
  long long s, s1;
  long long ans;
  while (q--) {
    x = read(), y = read();
    if (x < 0) {
      x = -x;
      w[x] = y;
      xg(1, n, 1, x);
    } else {
      if (x == y) {
        printf("0\n");
        continue;
      }
      s = qsum(1, n, 1, x, y);
      s = (s + 1) / 2;
      if (x == 1)
        s1 = 0;
      else
        s1 = qsum(1, n, 1, 1, x - 1);
      p = kth(1, n, 1, s1 + s);
      ans = 0;
      if (p != x) {
        ans = qdis(1, n, 1, x, p - 1, 1);
        ans -= (long long)(qsum(1, n, 1, x, p - 1)) * (a[n] - (n - p) - a[p]) %
               mod;
        ans %= mod;
      }
      if (p != y) {
        ans += qdis(1, n, 1, p + 1, y, 0);
        ans -= (long long)(qsum(1, n, 1, p + 1, y)) * (a[p] - p) % mod;
        ans %= mod;
      }
      ans = (ans % mod + mod) % mod;
      printf("%lld\n", ans);
    }
  }
  return 0;
}
