#include <bits/stdc++.h>
using namespace std;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7;
struct vertex {
  long long add, sum;
};
vertex lt[ml], rt[ml];
long long n, i, j, s, q;
vector<long long> x, w;
bool viv = false;
void build() {
  long long i;
  s = 1;
  while (s < n) s *= 2;
  for (i = 0; i < n; i++) lt[i + s].sum = w[i], rt[i + s].sum = w[i];
  for (i = s - 1; i > 0; i--) {
    lt[i].sum = lt[2 * i].sum + lt[2 * i + 1].sum,
    rt[i].sum = rt[2 * i].sum + rt[2 * i + 1].sum;
    lt[i].sum %= mod;
    rt[i].sum %= mod;
  }
}
void change(long long v, long long tl, long long tr, long long num,
            long long nw) {
  if (tl <= num && num <= tr) {
    lt[v].sum += nw;
    rt[v].sum += nw;
    if (num != tl) lt[v].add += (x[num] - x[tl] - num + tl) * nw;
    long long real_tr = min(tr, n - 1);
    if (num != real_tr) rt[v].add += (x[real_tr] - x[num] - real_tr + num) * nw;
    lt[v].add %= mod;
    rt[v].add %= mod;
    lt[v].add += mod;
    rt[v].add += mod;
    lt[v].add %= mod;
    rt[v].add %= mod;
  }
  long long tm = tl + tr >> 1;
  if (tl < tr) {
    change(2 * v, tl, tm, num, nw);
    change(2 * v + 1, tm + 1, tr, num, nw);
  }
}
long long getr(long long l, long long r, long long v, long long tl,
               long long tr, long long num) {
  if (r < tl || tr < l) return 0;
  if (l <= tl && tr <= r) {
    long long ret = rt[v].add;
    long long real_tr = min(tr, n - 1);
    ret += (rt[v].sum * (x[num] - x[real_tr] - num + real_tr));
    ret %= mod;
    ret += mod;
    ret %= mod;
    return ret;
  }
  long long tm = tl + tr >> 1;
  long long ret = 0;
  ret += getr(l, r, 2 * v, tl, tm, num);
  ret += getr(l, r, 2 * v + 1, tm + 1, tr, num);
  ret %= mod;
  return ret;
}
long long getl(long long l, long long r, long long v, long long tl,
               long long tr, long long num) {
  if (r < tl || tr < l) return 0;
  if (l <= tl && tr <= r) {
    long long ret = lt[v].add;
    ret += (lt[v].sum * (x[tl] - x[num] - tl + num));
    ret %= mod;
    ret += mod;
    ret %= mod;
    return ret;
  }
  long long tm = tl + tr >> 1;
  long long ret = 0;
  ret += getl(l, r, 2 * v, tl, tm, num);
  ret += getl(l, r, 2 * v + 1, tm + 1, tr, num);
  ret %= mod;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  x.resize(n);
  w.resize(n);
  for (auto &i : x) cin >> i;
  for (auto &i : w) cin >> i;
  s = 1;
  while (s < n) s *= 2;
  for (i = 0; i < n; i++) change(1, 0, s - 1, i, w[i]);
  if (viv) {
    for (i = 1; i < n + s; i++) cout << lt[i].sum << ' ';
    cout << endl;
    for (i = 1; i < n + s; i++) cout << rt[i].sum << ' ';
    cout << endl;
    for (i = 1; i < n + s; i++) cout << lt[i].add << ' ';
    cout << endl;
    for (i = 1; i < n + s; i++) cout << rt[i].add << ' ';
    cout << endl;
  }
  for (i = 0; i < q; i++) {
    long long a, b;
    cin >> a >> b;
    if (a < 0) {
      a = -a;
      a--;
      change(1, 0, s - 1, a, b - w[a]);
      w[a] = b;
    } else {
      a--;
      b--;
      long long mi = a + b >> 1;
      long long lans = 0;
      lans += getr(a, mi - 1, 1, 0, s - 1, mi);
      lans += getl(mi + 1, b, 1, 0, s - 1, mi);
      lans %= mod;
      lans += mod;
      lans %= mod;
      cout << lans << '\n';
    }
  }
  return 0;
}
