#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int P = 1e9 + 7;
int n, m, a[maxn], w[maxn];
inline int read() {
  char ch = getchar();
  int u = 0, f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    u = u * 10 + ch - 48;
    ch = getchar();
  }
  return u * f;
}
inline int pls(int x, int y) {
  x += y;
  return x >= P ? x - P : x;
}
inline int dec(int x, int y) {
  x -= y;
  return x < 0 ? x + P : x;
}
inline int mul(int x, int y) {
  long long rnt = 1ll * x * y;
  return (int)(rnt >= P ? rnt % P : rnt);
}
struct BIT {
  long long C[maxn];
  inline void modify(int p, int x) {
    while (p <= n) {
      C[p] += x;
      p += (-p & p);
    }
  }
  inline long long query(int p) {
    long long rnt = 0;
    while (p) {
      rnt += C[p];
      p -= (-p & p);
    }
    return rnt;
  }
} T;
struct _BIT {
  int C[maxn];
  inline void modify(int p, int x) {
    while (p <= n) {
      C[p] = pls(C[p], x);
      p += (-p & p);
    }
  }
  inline int query(int p) {
    int rnt = 0;
    while (p) {
      rnt = pls(rnt, C[p]);
      p -= (-p & p);
    }
    return rnt;
  }
} T0;
inline int getpos(int l, int r) {
  long long S = T.query(r) - T.query(l - 1), tmp = 0;
  int mid = (l + r) / 2, ans = 0, L = l;
  while (l <= r) {
    mid = (l + r) / 2;
    tmp = T.query(mid) - T.query(L - 1);
    if (tmp * 2 >= S)
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  return ans;
}
int main() {
  n = read();
  m = read();
  for (register int i = 1; i <= n; i++) a[i] = read() - i;
  for (register int i = 1; i <= n; i++) {
    w[i] = read();
    T.modify(i, w[i]);
    T0.modify(i, mul(a[i], w[i]));
  }
  for (register int i = 1; i <= m; i++) {
    int l = read(), r = read();
    if (l < 0) {
      T.modify(-l, r - w[-l]);
      T0.modify(-l, dec(mul(a[-l], r), mul(a[-l], w[-l])));
      w[-l] = r;
    } else {
      int pos = getpos(l, r);
      int S0 = (T.query(pos) - T.query(l - 1) + P) % P;
      int S1 = (T.query(r) - T.query(pos) + P) % P;
      int P1 = dec(mul(S0, a[pos]), dec(T0.query(pos), T0.query(l - 1)));
      int P2 = dec(dec(T0.query(r), T0.query(pos)), mul(S1, a[pos]));
      printf("%d\n", pls(P1, P2));
    }
  }
  return 0;
}
