#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const double eps = 1e-10;
const double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch;
  ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch & 15);
    ch = getchar();
  }
  if (f)
    return x;
  else
    return -x;
}
const int N = 2e5 + 10;
const long long mod = 1e9 + 7;
int n, q, w[N], a[N], x, y;
struct BIT1 {
  long long sum[N];
  void add(int i, long long c) {
    for (; i <= n; i += (i & (-i))) sum[i] = sum[i] + c;
  }
  long long query(int i) {
    long long ret = 0;
    for (; i >= 1; i -= (i & (-i))) ret = ret + sum[i];
    return ret;
  }
} bit1;
struct BIT2 {
  long long sum[N];
  void add(int i, long long c) {
    for (; i <= n; i += (i & (-i))) sum[i] = ((sum[i] + c) % mod + mod) % mod;
  }
  long long query(int i) {
    long long ret = 0;
    for (; i >= 1; i -= (i & (-i))) ret = (ret + sum[i]) % mod;
    return ret;
  }
} bit2;
void update(int i, int c) {
  int ls = c - w[i];
  bit1.add(i, 1ll * ls);
  bit2.add(i, 1ll * ls * a[i] % mod);
  w[i] = c;
}
int query(int L, int R) {
  long long ls = bit1.query(x - 1);
  ls = ((bit1.query(y) - ls + 1) >> 1) + ls;
  int l = L, r = R;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (bit1.query(mid) >= ls)
      r = mid;
    else
      l = mid + 1;
  }
  return (int)(((bit2.query(R) + bit2.query(L - 1) - bit2.query(l) -
                 bit2.query(l) + 2 * mod) %
                    mod +
                (bit1.query(l) + bit1.query(l) - bit1.query(L - 1) -
                 bit1.query(R) + 2 * mod) %
                    mod * a[l] % mod) %
               mod);
}
int main() {
  n = read();
  q = read();
  for (int i = 1; i <= n; i++) a[i] = read() - i;
  for (int i = 1; i <= n; i++) w[i] = read();
  for (int i = 1; i <= n; ++i)
    bit1.add(i, 1ll * w[i]), bit2.add(i, 1ll * w[i] * a[i] % mod);
  while (q--) {
    x = read();
    y = read();
    if (x < 0)
      update(-x, y);
    else
      printf("%d\n", query(x, y));
  }
  return 0;
}
