#include <bits/stdc++.h>
using namespace std;
const int N = 200010, LGN = 18, X = 1 << LGN, P = 1000000007;
int n, q;
int a[N], w[N];
int fw[N];
long long wfw[X];
int lowBit(int k) { return k & -k; }
long long lq(int k);
void lch(int k, int x);
int bound(long long v);
int qr(int k);
void ch(int k, int x);
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]);
    ch(i, w[i] * (long long)a[i] % P);
    lch(i, w[i]);
  }
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      int delt = y - w[x];
      w[x] = y;
      lch(x, delt);
      if ((delt %= P) < 0) delt += P;
      ch(x, delt * (long long)a[x] % P);
    } else {
      int pos = bound(lq(x - 1) + (lq(y) - lq(x - 1) + 1) / 2);
      int ans =
          ((qr(y) - qr(pos)) % P - (lq(y) - lq(pos)) % P * a[pos] % P) % P;
      if (ans < 0) ans += P;
      ans = (ans + (lq(pos - 1) - lq(x - 1)) % P * a[pos] % P -
             (qr(pos - 1) - qr(x - 1)) % P) %
            P;
      if (ans < 0) ans += P;
      printf("%d\n", ans);
    }
  }
  return 0;
}
int qr(int k) {
  int ret = 0;
  for (; k; k -= lowBit(k))
    if ((ret += fw[k]) >= P) ret -= P;
  return ret;
}
void ch(int k, int x) {
  for (; k <= n; k += lowBit(k))
    if ((fw[k] += x) >= P) fw[k] -= P;
}
long long lq(int k) {
  long long ret = 0;
  for (; k; k -= lowBit(k)) ret += wfw[k];
  return ret;
}
void lch(int k, int x) {
  for (; k < X; k += lowBit(k)) wfw[k] += x;
}
int bound(long long x) {
  int ret = 0;
  for (int k = LGN - 1; k >= 0; --k)
    if (x > wfw[ret | (1 << k)]) x -= wfw[ret |= 1 << k];
  return ret + 1;
}
