#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 200000;
const int MAXQ = 200000;
const int MOD = 1000000007;
const int MAXS = 4 * MAXN;
void inc(int &a, int b) {
  if ((a += b) >= MOD) a -= MOD;
}
int n, nq;
int a[MAXN];
int w[MAXN];
int qa[MAXQ], qb[MAXQ], qans[MAXQ];
long long ssum[MAXS];
int ssum2[MAXS];
void spull(int x) {
  ssum[x] = ssum[2 * x + 1] + ssum[2 * x + 2];
  ssum2[x] = (ssum2[2 * x + 1] + ssum2[2 * x + 2]) % MOD;
}
void sinit(int x, int l, int r) {
  if (l == r) {
    int idx = l;
    ssum[x] = w[idx];
    ssum2[x] = (long long)(a[idx] - idx) * w[idx] % MOD;
  } else {
    int m = l + (r - l) / 2;
    sinit(2 * x + 1, l, m);
    sinit(2 * x + 2, m + 1, r);
    spull(x);
  }
}
void sset(int x, int l, int r, int IDX, int VAL) {
  if (l == r) {
    ssum[x] = VAL;
    ssum2[x] = (long long)(a[IDX] - IDX) * VAL % MOD;
  } else {
    int m = l + (r - l) / 2;
    if (IDX <= m) sset(2 * x + 1, l, m, IDX, VAL);
    if (m + 1 <= IDX) sset(2 * x + 2, m + 1, r, IDX, VAL);
    spull(x);
  }
}
pair<long long, int> sget(int x, int l, int r, int L, int R) {
  if (L <= l && r <= R) {
    return make_pair(ssum[x], ssum2[x]);
  } else {
    int m = l + (r - l) / 2;
    pair<long long, int> ret = make_pair(0LL, 0);
    if (L <= m) {
      pair<long long, int> cur = sget(2 * x + 1, l, m, L, R);
      ret.first += cur.first;
      inc(ret.second, cur.second);
    }
    if (m + 1 <= R) {
      pair<long long, int> cur = sget(2 * x + 2, m + 1, r, L, R);
      ret.first += cur.first;
      inc(ret.second, cur.second);
    }
    return ret;
  }
}
int sfind(int x, int l, int r, int L, int R, long long &want) {
  if (l == r && want <= ssum[x]) {
    return l;
  } else if (L <= l && r <= R && ssum[x] < want) {
    want -= ssum[x];
    return -1;
  } else {
    int m = l + (r - l) / 2;
    if (L <= m) {
      int cur = sfind(2 * x + 1, l, m, L, R, want);
      if (cur != -1) return cur;
    }
    if (m + 1 <= R) {
      int cur = sfind(2 * x + 2, m + 1, r, L, R, want);
      if (cur != -1) return cur;
    }
    return -1;
  }
}
void solve() {
  sinit(0, 0, n - 1);
  for (int i = (0); i < (nq); ++i) {
    if (qa[i] < 0) {
      int idx = -qa[i] - 1, nw = qb[i];
      sset(0, 0, n - 1, idx, nw);
    } else {
      int l = qa[i] - 1, r = qb[i] - 1;
      long long wsum = sget(0, 0, n - 1, l, r).first;
      long long want = (wsum + 1) / 2;
      int mid = sfind(0, 0, n - 1, l, r, want);
      assert(mid != -1);
      pair<long long, int> lres = sget(0, 0, n - 1, l, mid);
      pair<long long, int> rres = sget(0, 0, n - 1, mid, r);
      qans[i] = (((long long)(a[mid] - mid) * (lres.first % MOD) - lres.second +
                  (mid - a[mid]) * (rres.first % MOD) + rres.second) %
                     MOD +
                 MOD) %
                MOD;
    }
  }
}
void run() {
  scanf("%d%d", &n, &nq);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  for (int i = (0); i < (n); ++i) scanf("%d", &w[i]);
  for (int i = (0); i < (nq); ++i) scanf("%d%d", &qa[i], &qb[i]);
  solve();
  for (int i = (0); i < (nq); ++i)
    if (qa[i] > 0) printf("%d\n", qans[i]);
}
int main() {
  run();
  return 0;
}
