#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int MOD = (int)1e9 + 7;
int n, q;
int a[N], w[N];
inline void Add(int &a, int b) {
  if ((a += b) >= MOD) a -= MOD;
  if (a < 0) a += MOD;
}
struct TR {
  int t[N];
  void Ad(int x, int v) {
    for (; x <= n; x += x & -x) Add(t[x], v);
  }
  int Qr(int x) {
    int re = 0;
    for (; x; x -= x & -x) Add(re, t[x]);
    return re;
  }
} W, Aw;
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i] -= i;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &w[i]);
    W.Ad(i, w[i]);
    Aw.Ad(i, (long long)a[i] * w[i] % MOD);
  }
  for (int x, y; q; --q) {
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      W.Ad(x, -w[x]);
      Aw.Ad(x, -(long long)a[x] * w[x] % MOD);
      w[x] = y;
      W.Ad(x, w[x]);
      Aw.Ad(x, (long long)a[x] * w[x] % MOD);
    } else {
      int lf = W.Qr(x - 1), rg = W.Qr(y);
      int sum = ((long long)rg - lf + MOD) % MOD;
      int l = x, r = y;
      for (int md; l < r;) {
        md = (l + r) >> 1;
        if (W.Qr(md) - lf >= (sum + 1) / 2)
          r = md;
        else
          l = md + 1;
      }
      int sr = W.Qr(r), d = a[r];
      long long ans1 = (long long)d * (sr - lf) - Aw.Qr(r) + Aw.Qr(x - 1);
      long long ans2 = Aw.Qr(y) - Aw.Qr(r) - (long long)d * (rg - sr);
      printf("%lld\n", ((ans1 + ans2) % MOD + MOD) % MOD);
    }
  }
  return 0;
}
