#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 17, mod = 1e9 + 7;
int n, q, a[maxn], w[maxn];
struct fen {
  __int128 iman[maxn];
  void majid(int p, __int128 v) {
    for (p++; p < maxn; p += p & -p) iman[p] += v;
  }
  __int128 hamid(int p) {
    __int128 ans = 0;
    for (; p; p ^= p & -p) ans += iman[p];
    return ans;
  }
  __int128 hamid(int l, int r) { return hamid(r) - hamid(l); }
} fw, faw, fwz;
__int128 get(int l, int r, int s) {
  int lo = s, hi = s + r - l;
  while (hi - lo > 1) {
    int mid = lo + hi >> 1;
    (a[mid - s] <= mid ? lo : hi) = mid;
  }
  int ta = lo - s + l + 1, tao = lo + 1;
  __int128 ans = 0;
  ans += fwz.hamid(l, ta) + (__int128)(s - l) * fw.hamid(l, ta);
  ans -= faw.hamid(l, ta);
  ans -= fwz.hamid(ta, r) + (__int128)(tao - ta) * fw.hamid(ta, r);
  ans += faw.hamid(ta, r);
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    fw.majid(i, w[i]);
    fwz.majid(i, w[i] * i);
    faw.majid(i, (__int128)a[i] * w[i]);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      x--;
      fw.majid(x, -w[x]);
      faw.majid(x, -(__int128)a[x] * w[x]);
      fwz.majid(x, -(__int128)w[x] * x);
      w[x] = y;
      fw.majid(x, w[x]);
      faw.majid(x, (__int128)a[x] * w[x]);
      fwz.majid(x, (__int128)w[x] * x);
    } else {
      x--;
      auto f = [&](int i) {
        __int128 ans = 0;
        ans += faw.hamid(i + 1, y) - fwz.hamid(i + 1, y) -
               fw.hamid(i + 1, y) * (a[i] - i);
        ans += fwz.hamid(x, i) + fw.hamid(x, i) * (a[i] - i) - faw.hamid(x, i);
        return ans;
      };
      __int128 ans = 1e36;
      int lo = x - 1, hi = y;
      while (hi - lo > 2) {
        int lh = lo + (hi - lo) / 3, rh = hi - (hi - lo) / 3;
        if (f(lh) < f(rh))
          hi = rh;
        else
          lo = lh;
      }
      cout << int(f(lo + 1) % mod) << '\n';
    }
  }
}
