#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;
}
namespace TR {
int taw[N];
long long tw[N];
void Ad(int x, int v1, int v2) {
  for (; x <= n; x += x & -x) {
    Add(taw[x], v2);
    tw[x] += v1;
  }
}
long long Qr_w(int x) {
  long long re = 0;
  for (; x; x -= x & -x) re += tw[x];
  return re;
}
int Qr_a(int x) {
  int re = 0;
  for (; x; x -= x & -x) Add(re, taw[x]);
  return re;
}
};  // namespace TR
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]);
    TR::Ad(i, w[i], (long long)a[i] * w[i] % MOD);
  }
  for (int x, y; q; --q) {
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      TR::Ad(x, -w[x], -(long long)a[x] * w[x] % MOD);
      w[x] = y;
      TR::Ad(x, w[x], (long long)a[x] * w[x] % MOD);
    } else {
      long long lf = TR::Qr_w(x - 1), rg = TR::Qr_w(y);
      int l = x, r = y;
      for (int md; l < r;) {
        md = (l + r) >> 1;
        if (TR::Qr_w(md) - lf >= (rg - lf + 2) / 2)
          r = md;
        else
          l = md + 1;
      }
      long long sr = TR::Qr_w(r);
      long long ans1 = (sr - lf) % MOD * a[r] - TR::Qr_a(r) + TR::Qr_a(x - 1);
      long long ans2 = TR::Qr_a(y) - TR::Qr_a(r) - (rg - sr) % MOD * a[r];
      printf("%lld\n", ((ans1 + ans2) % MOD + MOD) % MOD);
    }
  }
  return 0;
}
