#include <bits/stdc++.h>
using namespace std;
namespace mine {
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3fll;
long long qread() {
  long long ans = 0;
  char c = getchar();
  int f = 1;
  while (c < '0' or c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c and c <= '9') ans = ans * 10 + c - '0', c = getchar();
  return ans * f;
}
void write(long long num) {
  if (num < 0) {
    num = -num;
    putchar('-');
  }
  if (num > 9) write(num / 10);
  putchar('0' + num % 10);
}
void write1(long long num) {
  write(num);
  putchar(' ');
}
void write2(long long num) {
  write(num);
  puts("");
}
void chmax(long long &x, const long long y) { x = x > y ? x : y; }
void chmin(long long &x, const long long y) { x = x < y ? x : y; }
const int MAX_N = 2e5 + 10;
const long long MOD = 1e9 + 7;
void add(long long &x, long long y) {
  x += y;
  if (x >= MOD) x -= MOD;
  if (x < 0) x += MOD;
}
struct BIT {
  long long bit[MAX_N];
  BIT() { memset(bit, 0, sizeof bit); }
  int lowbit(int x) { return x & -x; }
  void add(int x, int c) {
    while (x < MAX_N) bit[x] += c, x += lowbit(x);
  }
  long long sum(int x) {
    long long ans = 0;
    while (x >= 1) ans += bit[x], x -= lowbit(x);
    return ans;
  }
  long long ask(int l, int r) { return (l > r) ? 0 : sum(r) - sum(l - 1); }
} bit, bit2;
long long a[MAX_N], b[MAX_N], w[MAX_N];
void main() {
  int n = qread(), q = qread();
  for (int i = 1; i <= n; i++) a[i] = qread(), b[i] = a[i] - i;
  for (int i = 1; i <= n; i++) {
    w[i] = qread(), bit.add(i, w[i]);
    bit2.add(i, w[i] * b[i] % MOD);
  }
  while (q--) {
    int x = qread(), y = qread();
    if (x < 0) {
      int id = -x, c = y;
      bit.add(id, -w[id]);
      bit2.add(id, -w[id] * b[id] % MOD);
      w[id] = c;
      bit.add(id, w[id]);
      bit2.add(id, w[id] * b[id] % MOD);
    } else {
      int l = x, r = y;
      long long now = 0;
      int T0 = a[l] - l;
      int mid = lower_bound(b + l, b + r + 1, T0) - b - 1;
      now -= bit2.ask(l, mid) % MOD - bit.ask(l, mid) % MOD * T0 % MOD;
      now += bit2.ask(mid + 1, r) % MOD - bit.ask(mid + 1, r) % MOD * T0 % MOD;
      now %= MOD;
      int fl = b[l], fr = b[r] - 1, T = -1;
      while (fl <= fr) {
        int mid = (fl + fr) >> 1;
        int tt = upper_bound(b + 1, b + n + 1, mid) - b - 1;
        if (bit.ask(l, tt) < bit.ask(tt + 1, r))
          T = mid, fl = mid + 1;
        else
          fr = mid - 1;
      }
      if (T >= 0) {
        int tt = upper_bound(b + 1, b + n + 1, T) - b - 1;
        now += -bit2.ask(l, tt) * 2 % MOD +
               bit.ask(l, tt) % MOD * (T + b[l] + 1) % MOD;
        now -= bit.ask(tt + 1, r) % MOD * (T - b[l] + 1) % MOD;
      }
      write2((now % MOD + MOD) % MOD);
    }
  }
}
};  // namespace mine
int main() {
  srand(time(0));
  mine::main();
}
