#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int INF = 1000000001;
int n, q;
long long segSum[800005], segMult[800005], w[200005], a[200005];
void update(long long seg[], int v, int l, int r, int index, long long x);
long long get(long long seg[], int v, int l, int r, int cl, int cr);
pair<int, long long> find(long long seg[], int v, int l, int r, int cl, int cr,
                          int s);
long long norm(long long a) {
  a %= mod;
  if (a > mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) {
    update(segSum, 1, 1, n, i, w[i]);
    update(segMult, 1, 1, n, i, norm(w[i] * a[i]));
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x *= -1;
      w[x] = y;
      update(segSum, 1, 1, n, x, w[x]);
      update(segMult, 1, 1, n, x, norm(w[x] * a[x]));
    } else {
      long long result = 0;
      auto pos = find(segSum, 1, 1, n, x, y, get(segSum, 1, 1, n, x, y) / 2);
      result = norm(result +
                    norm(a[pos.first] * get(segSum, 1, 1, n, x, pos.first)) -
                    norm(get(segMult, 1, 1, n, x, pos.first)));
      result = norm(result + norm(get(segMult, 1, 1, n, pos.first, y)) -
                    norm(a[pos.first] * get(segSum, 1, 1, n, pos.first, y)));
      cout << result << "\n";
    }
  }
  cout << "\n"
       << "\n";
  return 0;
}
void update(long long seg[], int v, int l, int r, int index, long long x) {
  if (l == r) {
    seg[v] = x;
    return;
  }
  int mid = (l + r) >> 1;
  if (index <= mid)
    update(seg, v * 2, l, mid, index, x);
  else
    update(seg, v * 2 + 1, mid + 1, r, index, x);
  seg[v] = seg[v * 2] + seg[v * 2 + 1];
}
long long get(long long seg[], int v, int l, int r, int cl, int cr) {
  if ((l == cl) && (r == cr)) return seg[v];
  int mid = (l + r) >> 1;
  long long result = 0;
  if (cl <= mid) result = get(seg, v * 2, l, mid, cl, min(cr, mid));
  if (cr > mid) result += get(seg, v * 2 + 1, mid + 1, r, max(cl, mid + 1), cr);
  return result;
}
pair<int, long long> find(long long seg[], int v, int l, int r, int cl, int cr,
                          int s) {
  if ((l == cl) && (r == cr)) {
    if (seg[v] <= s) return {INF, seg[v]};
    if (l == r) return {l, 0};
  }
  int mid = (l + r) >> 1;
  pair<int, long long> result = {INF, 0};
  if (cl <= mid) result = find(seg, v * 2, l, mid, cl, min(mid, cr), s);
  if ((cr > mid) && (result.first == INF)) {
    auto res = find(seg, v * 2 + 1, mid + 1, r, max(mid + 1, cl), cr,
                    s - result.second);
    result.first = min(result.first, res.first);
    result.second += res.second;
  }
  return result;
}
