#include <bits/stdc++.h>
using namespace std;
const int N = 3e5;
const long long M = 1e9 + 7;
struct BIT {
  int n;
  long long b[N];
  void init(int _n) {
    n = _n;
    fill(b, b + n + 1, 0);
  }
  void add(int i, long long x) {
    for (; i <= n; i += i & -i) {
      b[i] += x;
    }
  }
  long long sum(int i) {
    long long s = 0;
    for (; i > 0; i -= i & -i) {
      s += b[i];
    }
    return s;
  }
} B, B2;
int n, q, x, y, a[N], w[N];
bool check(int L, int R, int p) {
  long long sl = B.sum(p) - B.sum(L - 1);
  long long sr = B.sum(R) - B.sum(p);
  return sl >= sr;
}
int get_pos(int L, int R) {
  int l = L, r = R, mid, res;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(L, R, mid)) {
      res = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &q);
  B.init(n);
  B2.init(n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    B.add(i, w[i]);
    long long val = (long long)(a[i] - i) * w[i] % M;
    B2.add(i, val);
  }
  while (q--) {
    scanf("%d %d", &x, &y);
    if (x < 0) {
      x = -x;
      B.add(x, y - w[x]);
      long long det = (long long)(a[x] - x) * (y - w[x] + M) % M;
      B2.add(x, det);
      w[x] = y;
    } else {
      int p = get_pos(x, y);
      long long ans = 0;
      ans += (a[p] - p) * ((B.sum(p) - B.sum(x - 1)) % M) % M;
      ans += M - (B2.sum(p) % M - B2.sum(x - 1) % M + M) % M;
      ans += B2.sum(y) % M - B2.sum(p) % M + M;
      ans += M - (a[p] - p) * ((B.sum(y) - B.sum(p)) % M) % M;
      ans %= M;
      printf("%lld\n", ans);
    }
  }
}
