#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
const int MOD = 1000000007;
int le[N], ri[N], a[N];
long long sw[N], swa[N], w[N];
void init(int x, int l, int r) {
  le[x] = l;
  ri[x] = r;
  if (l == r) {
    sw[x] = w[l];
    swa[x] = w[l] * a[l] % MOD;
    return;
  }
  int m = (l + r) >> 1;
  init(x * 2, l, m);
  init(x * 2 + 1, m + 1, r);
  sw[x] = sw[x * 2] + sw[x * 2 + 1];
  swa[x] = (swa[x * 2] + swa[x * 2 + 1]) % MOD;
}
void update(int x, int id, long long nw) {
  if (le[x] == ri[x]) {
    sw[x] = nw;
    swa[x] = nw * a[id] % MOD;
    return;
  }
  int m = (le[x] + ri[x]) >> 1;
  if (id <= m)
    update(x * 2, id, nw);
  else
    update(x * 2 + 1, id, nw);
  sw[x] = sw[x * 2] + sw[x * 2 + 1];
  swa[x] = (swa[x * 2] + swa[x * 2 + 1]) % MOD;
}
long long getsw(int x, int l, int r) {
  if (le[x] >= l && ri[x] <= r) return sw[x];
  int m = (le[x] + ri[x]) >> 1;
  long long tmp = 0;
  if (l <= m) tmp += getsw(x * 2, l, r);
  if (r > m) tmp += getsw(x * 2 + 1, l, r);
  return tmp;
}
int find(int x, int l, int r, long long goalsw, long long &cursw) {
  if (le[x] > r || ri[x] < l) return 0;
  if (le[x] >= l && ri[x] <= r) {
    if (cursw + sw[x] <= goalsw) {
      cursw += sw[x];
      return 0;
    } else if (le[x] == ri[x])
      return le[x];
  }
  int ans = find(x * 2, l, r, goalsw, cursw);
  if (ans) return ans;
  return find(x * 2 + 1, l, r, goalsw, cursw);
}
long long solve(int x, int l, int r, int k) {
  if (le[x] >= l && ri[x] <= r)
    return (sw[x] % MOD * a[k] % MOD - swa[x]) % MOD;
  int m = (le[x] + ri[x]) >> 1;
  long long ret = 0;
  if (l <= m) ret += solve(x * 2, l, r, k);
  if (r > m) ret += solve(x * 2 + 1, l, r, k);
  return ret % MOD;
}
int main() {
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; i++) cin >> w[i];
  init(1, 1, n);
  while (q--) {
    int x;
    cin >> x;
    if (x < 0) {
      int id = -x;
      long long nw;
      cin >> nw;
      update(1, id, nw);
    } else {
      int l = x, r;
      cin >> r;
      long long sumw = getsw(1, l, r), cursw = 0;
      int k = find(1, l, r, sumw / 2, cursw);
      long long ans = 0;
      if (l < k) ans += solve(1, l, k - 1, k);
      if (r > k) ans -= solve(1, k + 1, r, k);
      cout << (ans % MOD + MOD) % MOD << "\n";
    }
  }
}
