#include <bits/stdc++.h>
const int N = 2e5 + 5;
const int mod = 1000000007;
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  int f = 1;
  static char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
inline void write(long long x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int n, Q;
long long a[N], w[N], b[N];
struct Tree {
  int l, r;
  long long sum, s;
} tree[4 * N];
inline void pushup(int now) {
  tree[now].sum = tree[now << 1].sum + tree[now << 1 | 1].sum;
  tree[now].s = (tree[now << 1].s + tree[now << 1 | 1].s) % mod;
}
inline void build(int now, int l, int r) {
  tree[now].l = l, tree[now].r = r;
  if (l == r) {
    tree[now].sum = w[l];
    tree[now].s = b[l] * w[l] % mod;
    return;
  }
  int m = (l + r) >> 1;
  build(now << 1, l, m);
  build(now << 1 | 1, m + 1, r);
  pushup(now);
}
inline long long query(int now, int l, int r) {
  if (l <= tree[now].l && tree[now].r <= r) return tree[now].sum;
  int m = (tree[now].l + tree[now].r) >> 1;
  long long ans = 0;
  if (l <= m) ans += query(now << 1, l, r);
  if (r > m) ans += query(now << 1 | 1, l, r);
  return ans;
}
inline void update(int now, int pos, int x) {
  if (tree[now].l == tree[now].r) {
    tree[now].sum = x;
    tree[now].s = b[pos] * x % mod;
    return;
  }
  int m = (tree[now].l + tree[now].r) >> 1;
  if (pos <= m)
    update(now << 1, pos, x);
  else
    update(now << 1 | 1, pos, x);
  pushup(now);
}
inline long long ask(int now, int l, int r) {
  if (l <= tree[now].l && tree[now].r <= r) return tree[now].s;
  int m = (tree[now].l + tree[now].r) >> 1;
  long long ans = 0;
  if (l <= m) ans = (ans + ask(now << 1, l, r)) % mod;
  if (r > m) ans = (ans + ask(now << 1 | 1, l, r)) % mod;
  return ans;
}
inline void Solve(int l, int r) {
  int L = l, R = r, ans = l;
  while (L <= R) {
    int mid = (L + R) >> 1;
    long long QL = query(1, l, mid), QR = query(1, mid + 1, r);
    if (QL >= QR)
      ans = mid, R = mid - 1;
    else
      L = mid + 1;
  }
  long long t1 = (query(1, l, ans - 1) % mod * (a[ans] - ans) % mod -
                  ask(1, l, ans - 1) + mod) %
                 mod;
  long long t2 = (query(1, ans + 1, r) % mod * (ans - a[ans] + mod) % mod +
                  ask(1, ans + 1, r) % mod) %
                 mod;
  write((t1 + t2) % mod);
  putchar('\n');
}
int main() {
  read(n), read(Q);
  for (register int i = 1; i <= n; i++) read(a[i]), b[i] = a[i] - i;
  for (register int i = 1; i <= n; i++) read(w[i]);
  build(1, 1, n);
  int l, r;
  while (Q--) {
    read(l), read(r);
    if (l < 0) update(1, -l, r);
    if (l > 0) Solve(l, r);
  }
  return 0;
}
