#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(228);
const int N = 2e5 + 7;
const int M = 1e9 + 7;
long long f_w[N];
long long f_aw[N];
void inc_w(int x, int y) {
  for (; x < N; x = (x | (x + 1))) {
    f_w[x] += y;
  }
}
void inc_aw(int x, long long y) {
  y %= M;
  if (y < 0) y += M;
  for (; x < N; x = (x | (x + 1))) {
    f_aw[x] += y;
    if (f_aw[x] >= M) {
      f_aw[x] -= M;
    }
  }
}
long long get_w(int x) {
  long long res = 0;
  for (; x >= 0; x = (x & (x + 1)) - 1) {
    res += f_w[x];
  }
  return res;
}
int get_aw(int x) {
  int res = 0;
  for (; x >= 0; x = (x & (x + 1)) - 1) {
    res += f_aw[x];
    if (res >= M) res -= M;
  }
  return res;
}
long long get_w(int l, int r) { return get_w(r) - get_w(l - 1); }
int get_aw(int l, int r) {
  int res = get_aw(r);
  res -= get_aw(l - 1);
  if (res < 0) res += M;
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    inc_w(i, w[i]);
    inc_aw(i, a[i] * (long long)w[i]);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      x--;
      inc_w(x, -w[x]);
      inc_aw(x, -(a[x] * (long long)w[x]));
      w[x] = y;
      inc_w(x, w[x]);
      inc_aw(x, (a[x] * (long long)w[x]));
    } else {
      x--, y--;
      long long sum = get_w(x, y);
      long long need = sum / 2 + get_w(x - 1);
      long long cur = 0;
      int l = x - 1, r = y;
      while (l < r - 1) {
        int m = (l + r) / 2;
        if (get_w(m) <= need) {
          l = m;
        } else {
          r = m;
        }
      }
      int p = l + 1;
      long long ans = -get_aw(x, p) + get_aw(p + 1, y);
      if (ans < 0) ans += M;
      ans += (get_w(x, p) * (long long)a[p]) % M;
      if (ans >= M) ans -= M;
      ans -= (get_w(p + 1, y) * (long long)a[p]) % M;
      if (ans < 0) ans += M;
      cout << ans << '\n';
    }
  }
}
