#include <bits/stdc++.h>
using namespace std;
long long n, q, t1[800000];
long long w[800000], a[800000], t2[800000];
void build(int left, int right, int p) {
  if (left == right) {
    t1[p] = w[left];
    t2[p] = w[left] * (left - a[left]);
    t2[p] %= 1000000007;
    return;
  }
  int mid = (left + right) >> 1;
  build(left, mid, p * 2);
  build(mid + 1, right, p * 2 + 1);
  t1[p] = t1[p * 2] + t1[p * 2 + 1];
  t2[p] = t2[p * 2] + t2[p * 2 + 1];
  t2[p] %= 1000000007;
}
void update1(int left, int right, int q, int p, long long c) {
  if (left > q || right < q) {
    return;
  }
  if (left == right) {
    t1[p] += c;
    return;
  }
  int mid = (left + right) >> 1;
  update1(left, mid, q, p * 2, c);
  update1(mid + 1, right, q, p * 2 + 1, c);
  t1[p] = t1[p * 2] + t1[p * 2 + 1];
}
void update2(int left, int right, long long q, int p, long long c) {
  if (left > q || right < q) {
    return;
  }
  if (left == right) {
    t2[p] += c * (q - a[q]);
    t2[p] %= 1000000007;
    return;
  }
  int mid = (left + right) >> 1;
  update2(left, mid, q, p * 2, c);
  update2(mid + 1, right, q, p * 2 + 1, c);
  t2[p] = t2[p * 2] + t2[p * 2 + 1];
  t2[p] %= 1000000007;
}
long long query1(int left, int right, int ql, int qr, int p) {
  if (left >= ql && right <= qr) {
    return t1[p];
  }
  if (left > qr || right < ql) {
    return 0;
  }
  long long mid = (left + right) >> 1;
  return query1(left, mid, ql, qr, p * 2) +
         query1(mid + 1, right, ql, qr, p * 2 + 1);
}
long long query2(int left, int right, int ql, int qr, int p) {
  if (left >= ql && right <= qr) {
    return t2[p];
  }
  if (left > qr || right < ql) {
    return 0;
  }
  int mid = (left + right) >> 1;
  return (query2(left, mid, ql, qr, p * 2) +
          query2(mid + 1, right, ql, qr, p * 2 + 1)) %
         1000000007;
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  build(1, n, 1);
  while (q--) {
    long long x, y;
    scanf("%I64d%I64d", &x, &y);
    if (x < 0) {
      x = -x;
      update1(1, n, x, 1, y - w[x]);
      update2(1, n, x, 1, y - w[x]);
      w[x] = y;
    } else {
      long long l = 1, r = n, res = 0;
      while (l <= r) {
        long long mid = (l + r) >> 1;
        if (query1(1, n, x, mid, 1) < query1(1, n, mid + 1, y, 1)) {
          l = mid + 1;
        } else {
          res = mid;
          r = mid - 1;
        }
      }
      long long ans =
          (query1(1, n, x, res - 1, 1) % 1000000007 * (a[res] - res)) %
              1000000007 +
          query2(1, n, x, res - 1, 1) +
          (query1(1, n, res + 1, y, 1) % 1000000007 * (res - a[res])) %
              1000000007 -
          query2(1, n, res + 1, y, 1);
      while (ans < 0) ans += 1000000007;
      printf("%I64d\n", ans % 1000000007);
    }
  }
  return 0;
}
