#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int read() {
  int x = 0, w = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
  return x * w;
}
const int N = 2e5 + 10, Mod = 1e9 + 7;
int n, q, a[N], w[N], c2[N];
long long c1[N];
void add1(int x, long long val) {
  for (; x <= n; x += ((x) & (-x))) c1[x] += val;
}
void add2(int x, int val) {
  for (; x <= n; x += ((x) & (-x))) (c2[x] += val) %= Mod;
}
long long query1(int x) {
  long long res = 0;
  for (; x; x -= ((x) & (-x))) res += c1[x];
  return res;
}
int query2(int x) {
  int res = 0;
  for (; x; x -= ((x) & (-x))) (res += c2[x]) %= Mod;
  return res;
}
int main() {
  memset(c1, 0, sizeof(c1));
  memset(c2, 0, sizeof(c2));
  n = read();
  q = read();
  for (int i = 1; i <= n; i++) a[i] = read() - i + n;
  for (int i = 1; i <= n; i++) {
    w[i] = read();
    add1(i, w[i]);
    add2(i, 1ll * w[i] * a[i] % Mod);
  }
  while (q--) {
    int x = read(), y = read();
    if (x < 0) {
      x = -x;
      add1(x, -w[x]);
      add2(x, (-1ll * w[x] * a[x] % Mod + Mod) % Mod);
      w[x] = y;
      add1(x, w[x]);
      add2(x, 1ll * w[x] * a[x] % Mod);
    } else {
      long long s1 = query1(x - 1), s2 = query1(y) - s1;
      int l = x, r = y, pos = y;
      while (l <= r) {
        int mid = (l + r) >> 1;
        long long now = query1(mid) - s1;
        if (now * 2 >= s2)
          r = mid - 1, pos = mid;
        else
          l = mid + 1;
      }
      l = x;
      r = y;
      long long t1 = query2(pos) - query2(l - 1);
      long long t2 = -1ll * a[pos] * ((query1(pos) - s1) % Mod) % Mod;
      long long t3 = query2(r) - query2(pos);
      long long t4 = -1ll * a[pos] * ((query1(r) - query1(pos)) % Mod) % Mod;
      long long ans = (t3 + t4 - t1 - t2) % Mod;
      ans = (ans + Mod) % Mod;
      printf("%lld\n", ans);
    }
  }
  return 0;
}
