#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 100;
int n;
struct Tree {
  long long tree[MAX_N];
  void update(int k, long long val) {
    while (k <= n) {
      tree[k] += val;
      k += (k & -k);
    }
  }
  long long sum(int k) {
    long long res = 0;
    while (k > 0) {
      res += tree[k];
      k -= (k & -k);
    }
    return res;
  }
} t1, t2;
long long a[MAX_N], w[MAX_N];
int BIS(int ql, int qr) {
  int l = ql, r = qr, mid, res;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (t1.sum(mid) - t1.sum(ql - 1) < t1.sum(qr) - t1.sum(mid)) {
      l = mid + 1;
    } else {
      res = mid;
      r = mid - 1;
    }
  }
  return res;
}
int main() {
  int q;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &w[i]);
  }
  for (int i = 1; i <= n; i++) {
    t1.update(i, w[i]);
    t2.update(i, w[i] * (a[i] - i) % 1000000007);
  }
  long long x, y;
  for (int i = 1; i <= q; i++) {
    scanf("%lld %lld", &x, &y);
    if (x < 0) {
      t1.update(-x, y - w[-x]);
      t2.update(-x, (y - w[-x]) * (a[-x] + x) % 1000000007);
      w[-x] = y;
    } else {
      int r = y, l = x;
      int pos = BIS(x, y);
      long long res = 0;
      res = (res + (t1.sum(pos - 1) - t1.sum(l - 1)) * (a[pos] - pos)) %
            1000000007;
      res = (res - (t2.sum(pos - 1) - t2.sum(l - 1))) % 1000000007;
      res = (res - (t1.sum(r) - t1.sum(pos)) * (a[pos] - pos)) % 1000000007;
      res = (res + t2.sum(r) - t2.sum(pos)) % 1000000007;
      res = (res + 1000000007) % 1000000007;
      printf("%lld\n", res);
    }
  }
  return 0;
}
