#include <bits/stdc++.h>
using namespace std;
int n, q, a[210000], w[210000];
long long W[210000], AW[210000];
void modify(long long *b, int x, long long y) {
  for (; x <= n; x += x & -x) b[x] += y;
}
long long query(long long *b, int x) {
  long long ans = 0;
  for (; x; x -= x & -x) ans += b[x];
  return ans;
}
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]);
  }
  for (int i = 1; i <= n; i++) {
    modify(W, i, w[i]);
    modify(AW, i, 1LL * a[i] * w[i] % 1000000007);
  }
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      modify(W, x, -w[x]);
      modify(AW, x, -(1LL * a[x] * w[x] % 1000000007));
      w[x] = y;
      modify(W, x, w[x]);
      modify(AW, x, (1LL * a[x] * w[x] % 1000000007));
    } else {
      long long base = query(W, x - 1);
      long long SW = query(W, y) - base;
      int l = x - 1, r = y, mid;
      while (l < r - 1) {
        mid = (l + r) / 2;
        if (query(W, mid) - base >= (SW + 1) / 2)
          r = mid;
        else
          l = mid;
      }
      long long ans = 0;
      if (x < r) {
        ans += 1LL * a[r] * ((query(W, r - 1) - query(W, x - 1)) % 1000000007) %
               1000000007;
        ans -= (query(AW, r - 1) - query(AW, x - 1)) % 1000000007;
      }
      if (r < y) {
        ans -= 1LL * a[r] * ((query(W, y) - query(W, r)) % 1000000007) %
               1000000007;
        ans += (query(AW, y) - query(AW, r)) % 1000000007;
      }
      ans = ((ans % 1000000007) + 1000000007) % 1000000007;
      printf("%I64d\n", ans);
    }
  }
}
