#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200100;
const int P = (1 << 18);
const int MAXP = 2 * P + 10;
const int MOD = 1e9 + 7;
int N, Q;
long long a[MAXN];
long long w[MAXN];
long long wseg[MAXP], wiseg[MAXP], waseg[MAXP];
void upd(long long* seg, int cloc, long long cdiff, bool mmod) {
  cloc += P;
  while (cloc) {
    seg[cloc] += cdiff;
    if (mmod) seg[cloc] %= MOD;
    cloc /= 2;
  }
}
long long add(long long* seg, int cloc, bool mmod) {
  long long res = 0;
  cloc += P;
  while (cloc > 1) {
    if (cloc & 1) {
      res += seg[cloc - 1];
      if (mmod) res %= MOD;
    }
    cloc /= 2;
  }
  return res;
}
int wsearch(long long sgoal) {
  int cloc = 1;
  while (cloc < P) {
    if (wseg[2 * cloc] >= sgoal)
      cloc *= 2;
    else {
      sgoal -= wseg[2 * cloc];
      cloc *= 2;
      cloc++;
    }
  }
  return cloc - P;
}
int findm(int lo, int hi) {
  long long sleft = add(wseg, lo, 0), sright = add(wseg, hi + 1, 0);
  long long sgoal = (sleft + sright + 1) / 2;
  return wsearch(sgoal);
}
int main() {
  scanf("%d %d", &N, &Q);
  for (int i = 0; i < N; i++) {
    int x;
    scanf("%d", &x);
    a[i] = x;
  }
  for (int i = 0; i < N; i++) {
    int x;
    scanf("%d", &x);
    w[i] = x;
  }
  for (int i = 0; i < N; i++) {
    upd(wseg, i, w[i], 0);
    upd(wiseg, i, i * w[i], 1);
    upd(waseg, i, a[i] * w[i], 1);
  }
  for (int i = 0; i < Q; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    if (l < 0) {
      int cloc = -l - 1;
      long long cdiff = r - w[cloc];
      upd(wseg, cloc, cdiff, 0);
      upd(wiseg, cloc, cloc * cdiff, 1);
      upd(waseg, cloc, a[cloc] * cdiff, 1);
      w[cloc] = r;
    } else {
      l--, r--;
      int mm = findm(l, r);
      long long ws = ((add(wseg, mm, 1) - add(wseg, l, 1)) % MOD + MOD) % MOD;
      long long wis =
          ((add(wiseg, mm, 1) - add(wiseg, l, 1)) % MOD + MOD) % MOD;
      long long was =
          ((add(waseg, mm, 1) - add(waseg, l, 1)) % MOD + MOD) % MOD;
      long long res = ws * (a[mm] - mm) + wis - was;
      r++;
      ws = ((add(wseg, r, 1) - add(wseg, mm, 1)) % MOD + MOD) % MOD;
      wis = ((add(wiseg, r, 1) - add(wiseg, mm, 1)) % MOD + MOD) % MOD;
      was = ((add(waseg, r, 1) - add(waseg, mm, 1)) % MOD + MOD) % MOD;
      long long bres = ws * (mm - a[mm]) - wis + was;
      res = ((res + bres) % MOD + MOD) % MOD;
      printf("%d\n", (int)res);
    }
  }
}
