#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int MOD = 1e9 + 7;
long long dist[N], cnt[N], a[N], w[N], L[N], R[N];
void update(long long* f, int p, long long x, int flg = 0) {
  while (p < N) {
    if (flg)
      f[p] += x;
    else {
      if ((f[p] += x) >= MOD) f[p] -= MOD;
    };
    p += p & -p;
  }
}
long long query(long long* f, int p, int flg = 0) {
  long long res = 0;
  while (p) {
    if (flg)
      res += f[p];
    else {
      if ((res += f[p]) >= MOD) res -= MOD;
    };
    p -= p & -p;
  }
  return res;
}
long long sum(long long* f, int l, int r, int flg = 0) {
  if (l > r) return 0;
  if (flg) return query(f, r, 1) - query(f, l - 1, 1);
  long long res = query(f, r);
  {
    if ((res += MOD - query(f, l - 1)) >= MOD) res -= MOD;
  };
  return res;
}
long long qsm(long long* f, int l, int r, long long x, int flg = 0) {
  if (l > r) return 0;
  long long res = sum(f, l, r, flg);
  {
    if ((res += MOD - x * (sum(cnt, l, r, 1) % MOD) % MOD) >= MOD) res -= MOD;
  };
  return res;
}
int search(int ql, int qr) {
  int l = ql, r = qr, res = ql;
  long long tot = sum(cnt, ql, qr, 1) / 2;
  while (l <= r) {
    int mid = l + r >> 1;
    if (sum(cnt, ql, mid, 1) <= tot) {
      res = mid + 1;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  return min(qr, res);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    update(dist, i, (long long)a[i] * w[i] % MOD);
    update(cnt, i, w[i], 1);
    update(L, i, (n - i + 1LL) * w[i] % MOD);
    update(R, i, (long long)i * w[i] % MOD);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      update(cnt, x, y - w[x], 1);
      long long ch = (y - w[x] + MOD) % MOD;
      w[x] = y;
      update(dist, x, a[x] * ch % MOD);
      update(L, x, (n - x + 1LL) * ch % MOD);
      update(R, x, x * ch % MOD);
    } else {
      int pos = search(x, y);
      long long cl = sum(cnt, x, pos - 1, 1) % MOD,
                cr = sum(cnt, pos + 1, y, 1) % MOD;
      long long res = 0;
      {
        if ((res += a[pos] * cl % MOD) >= MOD) res -= MOD;
      };
      {
        if ((res += MOD - sum(dist, x, pos - 1)) >= MOD) res -= MOD;
      };
      {
        if ((res += sum(dist, pos + 1, y)) >= MOD) res -= MOD;
      };
      {
        if ((res += MOD - a[pos] * cr % MOD) >= MOD) res -= MOD;
      };
      {
        if ((res += MOD - qsm(L, x, pos - 1, n - pos + 1)) >= MOD) res -= MOD;
      };
      {
        if ((res += MOD - qsm(R, pos + 1, y, pos)) >= MOD) res -= MOD;
      };
      cout << res << endl;
    }
  }
  return 0;
}
