#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const long long MOD = 1e9 + 7;
const int MAX = 200 * 1000 + 7;
int sub(int x, int y) {
  x -= y;
  if (x < 0) x += MOD;
  return x;
}
int mult(int x, int y) { return x * (long long)y % MOD; }
int add(int x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
  return x;
}
struct TreeSum {
  long long t[4 * MAX];
  bool mo = 1;
  TreeSum() { memset(t, 0, sizeof(t)); }
  void update(int v, int l, int r, int pos, long long x) {
    if (l == r) {
      t[v] = x;
      return;
    }
    int m = (l + r) / 2;
    if (pos > m)
      update(v + v + 1, m + 1, r, pos, x);
    else
      update(v + v, l, m, pos, x);
    t[v] = t[v + v] + t[v + v + 1];
    if (mo) t[v] %= MOD;
  }
  int find(int v, int l, int r, long long sum) {
    if (l == r) return l;
    int m = (l + r) / 2;
    if (t[v + v] >= sum)
      return find(v + v, l, m, sum);
    else
      return find(v + v, m + 1, r, sum - t[v + v]);
  }
  long long sum(int v, int tl, int tr, int l, int r) {
    if (r < l) return 0;
    if (l == tl && tr == r) return t[v];
    int tm = (tl + tr) / 2;
    long long ans = (sum(v + v, tl, tm, l, min(r, tm)) +
                     sum(v + v + 1, tm + 1, tr, max(l, tm + 1), r));
    if (mo) ans %= MOD;
    return ans;
  }
} Tsum, Tpref, Tsuf, Tpref1, Tsuf1;
int a[MAX];
int w[MAX];
long long pref[MAX];
long long suf[MAX];
int solve(int l, int r, int n) {
  long long sumr = Tsum.sum(1, 0, n - 1, 0, r);
  long long suml = Tsum.sum(1, 0, n - 1, 0, l - 1);
  int m = Tsum.find(1, 0, n - 1, suml + (sumr - suml) / 2);
  long long sum1 =
      sub(Tsuf.sum(1, 0, n - 1, l, m - 1),
          mult(Tsum.sum(1, 0, n - 1, l, m - 1), (a[n - 1] - a[m])));
  long long sum2 = sub(Tpref.sum(1, 0, n - 1, m + 1, r),
                       mult(Tsum.sum(1, 0, n - 1, m + 1, r), (a[m] - a[0])));
  long long x1 = sub(Tpref1.sum(1, 0, n - 1, m + 1, r),
                     mult(Tsum.sum(1, 0, n - 1, m + 1, r), m));
  long long x2 = sub(Tsuf1.sum(1, 0, n - 1, l, m - 1),
                     mult(Tsum.sum(1, 0, n - 1, l, m - 1), n - m));
  return sub(add(sum1, sum2), add(x1, x2));
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  Tsum.mo = 0;
  for (int i = (0); i < (n); ++i) {
    cin >> w[i];
    Tsum.update(1, 0, n - 1, i, w[i]);
    pref[i] = (a[i] - a[0]) * (long long)w[i];
    Tpref.update(1, 0, n - 1, i, pref[i]);
    suf[i] = (a[n - 1] - a[i]) * (long long)w[i];
    Tsuf.update(1, 0, n - 1, i, suf[i]);
    Tpref1.update(1, 0, n - 1, i, w[i] * (long long)i);
    Tsuf1.update(1, 0, n - 1, i, w[i] * (long long)(n - i));
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      int i = -x - 1;
      w[i] = y;
      Tsum.update(1, 0, n - 1, i, w[i]);
      pref[i] = (a[i] - a[0]) * (long long)w[i];
      Tpref.update(1, 0, n - 1, i, pref[i]);
      suf[i] = (a[n - 1] - a[i]) * (long long)w[i];
      Tsuf.update(1, 0, n - 1, i, suf[i]);
      Tpref1.update(1, 0, n - 1, i, w[i] * (long long)i);
      Tsuf1.update(1, 0, n - 1, i, w[i] * (long long)(n - i));
    } else
      cout << solve(x - 1, y - 1, n) << endl;
  }
  return 0;
}
