#include <bits/stdc++.h>
using namespace std;
long long aw[200001], w[200001], p[200001], st[200001], sumst[200001],
    sumaw[200001], sumw[200001], cd, mod = 1e9 + 7, q, x, y;
void update(long long a[], long long x, long long val, int type) {
  while (x <= cd) {
    a[x] += val;
    if (type == 0) a[x] %= mod;
    x += (x & -x);
  }
}
void inp() {
  cin >> cd >> q;
  for (long long i = 1; i <= cd; i++) cin >> p[i];
  for (long long i = 1; i <= cd; i++) cin >> w[i];
  for (long long i = 1; i <= cd; i++) {
    update(sumaw, i, w[i] * p[i], 0);
    aw[i] = w[i] * p[i];
    update(sumw, i, w[i], 1);
    update(sumst, i, w[i] * i, 0);
    st[i] = w[i] * i;
  }
}
long long get(long long a[], long long x, long long type) {
  long long k = 0;
  while (x > 0) {
    k += a[x];
    if (type == 0) k %= mod;
    x -= (x & -x);
  }
  return k;
}
long long getaw(long long l, long long r) {
  if (l > r) return 0;
  return (get(sumaw, r, 0) - get(sumaw, l - 1, 0) + mod * 5) % mod;
}
long long getw(long long l, long long r) {
  if (l > r) return 0;
  return (get(sumw, r, 1) - get(sumw, l - 1, 1));
}
long long getst(long long l, long long r, long long st) {
  if (l > r) return 0;
  return (get(sumst, r, 0) - get(sumst, l - 1, 0) -
          (l - st) * (getw(l, r) % mod) % mod + mod * 10) %
         mod;
}
void do_it() {
  for (long long i = 1; i <= q; i++) {
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      update(sumw, x, y - w[x], 1);
      w[x] = y;
      update(sumaw, x, y * p[x] - aw[x], 0);
      aw[x] = y * p[x];
      update(sumst, x, y * x - st[x], 0);
      st[x] = y * x;
    } else {
      long long l = x, r = y, pos, need = (getw(l, r) + 1) / 2;
      while (r >= l) {
        long long mid = (l + r) / 2;
        if (getw(x, mid) >= need)
          pos = mid, r = mid - 1;
        else
          l = mid + 1;
      }
      long long t = pos;
      pos = p[pos] - (pos - x);
      cout << (-(getaw(x, t) - getw(x, t) % mod * pos % mod - getst(x, t, 0) +
                 mod * 5) +
               (getaw(t + 1, y) - getw(t + 1, y) % mod * pos % mod -
                getst(t + 1, y, t - x + 1)) +
               mod * 1000) %
                  mod
           << '\n';
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  inp(), do_it();
}
