#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;
int n, q, a[N], w[N];
long long ans;
void upd(int &x, int y) {
  x += y;
  x -= x >= mod ? mod : 0;
}
long long t[N];
void add(int x, int y) {
  for (; x <= n; x += x & -x) t[x] += y;
}
long long qry(int x) {
  long long s = 0;
  for (; x; x -= x & -x) s += t[x];
  return s;
}
int t2[N];
void add2(int x, int y) {
  for (; x <= n; x += x & -x) upd(t2[x], y);
}
int qry2(int x) {
  int s = 0;
  for (; x; x -= x & -x) upd(s, t2[x]);
  return s;
}
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]), add(i, w[i]), add2(i, (long long)w[i] * a[i] % mod);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      add(x, y - w[x]);
      add2(x, (long long)(y + mod - w[x]) * a[x] % mod);
      w[x] = y;
    } else {
      int l = x, r = y, mid;
      long long tmp1 = qry(x - 1), tmp2 = qry(y);
      while (l <= r) {
        mid = l + r >> 1;
        if (2ll * qry(mid) - tmp1 >= tmp2)
          r = mid - 1;
        else
          l = mid + 1;
      }
      r++;
      ans = (qry(r - 1) % mod - tmp1 % mod) * a[r] % mod -
            (qry2(r - 1) - qry2(x - 1));
      ans += (qry2(y) - qry2(r)) - (tmp2 % mod - qry(r) % mod) * a[r] % mod;
      ans = (ans % mod + mod) % mod;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
