#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
const long long INF = 1e9 + 7;
const long long mod = 1e9 + 7;
struct data {
  long long a, b, c;
} tree[N << 2 | 1];
long long n, Q, t, a[N], w[N];
data operator+(const data &a, const data &b) {
  data c;
  c.a = a.a + b.a;
  c.b = (a.b + b.b) % mod;
  c.c = (a.c + b.c) % mod;
  return c;
}
inline void init(long long k, long long l, long long r) {
  if (l == r)
    tree[k] = {w[l], w[l] * (l - a[l]) % mod, w[l] * (a[l] - l) % mod};
  else {
    long long mid = (l + r) >> 1;
    init(k << 1, l, mid);
    init(k << 1 | 1, mid + 1, r);
    tree[k] = tree[k << 1] + tree[k << 1 | 1];
  }
}
inline void update(long long k, long long l, long long r, long long pos) {
  if (l > pos || r < pos) return;
  if (l == r && l == pos)
    tree[k] = {w[l], w[l] * (l - a[l]) % mod, w[l] * (a[l] - l) % mod};
  else {
    long long mid = (l + r) >> 1;
    update(k << 1, l, mid, pos);
    update(k << 1 | 1, mid + 1, r, pos);
    tree[k] = tree[k << 1] + tree[k << 1 | 1];
  }
}
inline data query(long long k, long long l, long long r, long long L,
                  long long R) {
  if (l > R || r < L) return {0, 0, 0};
  if (L <= l && r <= R)
    return tree[k];
  else {
    long long mid = (l + r) >> 1;
    return query(k << 1, l, mid, L, R) + query(k << 1 | 1, mid + 1, r, L, R);
  }
}
inline long long sum(const long long &l, const long long &r,
                     const long long &num) {
  if (num == 1) return query(1, 1, n, l, r).a;
  if (num == 2) return query(1, 1, n, l, r).b;
  if (num == 3) return query(1, 1, n, l, r).c;
}
inline long long Find(long long k, long long l, long long r, long long val) {
  if (l == r) return l;
  long long mid = (l + r) >> 1;
  if (t % 2 == 0) {
    if (tree[k << 1].a > val) return Find(k << 1, l, mid, val);
    return Find(k << 1 | 1, mid + 1, r, val - tree[k << 1].a);
  } else {
    if (tree[k << 1].a >= val) return Find(k << 1, l, mid, val);
    return Find(k << 1 | 1, mid + 1, r, val - tree[k << 1].a);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  scanf("%lld%lld", &n, &Q);
  for (long long i = 1; i <= n; i++) scanf("%lld", a + i);
  for (long long i = 1; i <= n; i++) scanf("%lld", w + i);
  init(1, 1, n);
  while (Q--) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    if (x < 0) {
      x = -x;
      w[x] = y;
      update(1, 1, n, x);
    } else {
      long long k = 0;
      t = sum(x, y, 1);
      long long ss = (sum(x, y, 1) + 1) / 2;
      k = Find(1, 1, n, ss + sum(1, x - 1, 1));
      long long s = 0;
      s = (s + (a[k] * (sum(x, k - 1, 1) % mod) % mod) -
           (k * (sum(x, k - 1, 1) % mod) % mod) + mod) %
          mod;
      s = (s + (sum(x, k - 1, 2) % mod) + mod) % mod;
      s = (s - (a[k] * (sum(k, y, 1) % mod) % mod) +
           (k * (sum(k, y, 1) % mod) % mod) + mod) %
          mod;
      s = (s + (sum(k, y, 3) % mod) + mod) % mod;
      printf("%lld\n", s);
    }
  }
  return 0;
}
