#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
using namespace std;
const int N = 3e5 + 10;
const int MOD = 1e9 + 7;
int a[N], w[N], n;
struct BIT {
  long long bit[N];
  int ty;
  void add(int x, long long a) {
    while (x <= n) {
      if (ty == 0)
        bit[x] = (bit[x] + a) % MOD;
      else
        bit[x] = bit[x] + a;
      x += x & -x;
    }
  }
  long long sum(int x) {
    long long res = 0;
    while (x) {
      if (ty == 0)
        res = (res + bit[x]) % MOD;
      else
        res = res + bit[x];
      x -= x & -x;
    }
    return res;
  }
} b1, b2;
void solve(int x, int y) {
  if (x == y) {
    printf("0\n");
    return;
  }
  int l = x, r = y, m = l + r >> 1;
  long long tot = b1.sum(r) - b1.sum(l - 1);
  long long sub = b1.sum(l - 1);
  while (l < r) {
    if ((b1.sum(m) - sub) * 2 >= tot)
      r = m;
    else
      l = m + 1;
    m = l + r >> 1;
  }
  long long ans = 0, cnt = a[m] - m;
  cnt %= MOD;
  ans = (ans + cnt * ((b1.sum(m) - b1.sum(x - 1)) % MOD) % MOD -
         (b2.sum(m) - b2.sum(x - 1))) %
        MOD;
  ans = (ans - cnt * ((b1.sum(y) - b1.sum(m)) % MOD) % MOD +
         (b2.sum(y) - b2.sum(m))) %
        MOD;
  ans = (ans + MOD) % MOD;
  printf("%lld\n", ans);
}
int main() {
  int q, x, y;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  b1.ty = 1;
  b2.ty = 0;
  for (int i = 1; i <= n; i++) {
    b1.add(i, w[i]);
    b2.add(i, 1LL * w[i] * (a[i] - i));
  }
  while (q--) {
    scanf("%d %d", &x, &y);
    if (x < 0) {
      x = -x;
      b1.add(x, -w[x]);
      b2.add(x, -1LL * w[x] * (a[x] - x));
      w[x] = y;
      b1.add(x, w[x]);
      b2.add(x, 1LL * w[x] * (a[x] - x));
    } else
      solve(x, y);
  }
  return 0;
}
