#include <bits/stdc++.h>
const int md = 1e9 + 7, inf = 1e9 + 7;
const long long hs = 199;
const long double eps = 1e-9, pi = acos(-1);
using namespace std;
struct fenwick {
  int n;
  vector<long long> a, sl, co;
  fenwick() {}
  fenwick(const vector<long long> &aa) {
    a = aa;
    n = a.size();
    a.insert(a.begin(), 0);
    sl.resize(n + 1, 0);
    co.resize(n + 1, 0);
  }
  void upd(int i, long long x) {
    i++;
    long long add2 = a[i] * x;
    for (; i <= n; i += (i & -i)) {
      sl[i] += x;
      co[i] += add2;
    }
  }
  long long que(int i, long long x) {
    long long s1 = 0, s2 = 0;
    for (; i; i -= (i & -i)) {
      s1 += sl[i];
      s2 += co[i];
    }
    return s1 * x - s2;
  }
  long long query(int l, int r, long long x) {
    l++, r++;
    return x * (sum(r) - sum(l - 1)) - (sum2(r) - sum2(l - 1));
  }
  long long sum(int i) {
    long long rtn = 0;
    for (; i; i -= (i & -i)) {
      rtn += sl[i];
    }
    return rtn;
  }
  long long sum(int l, int r) {
    l++, r++;
    return sum(r) - sum(l - 1);
  }
  long long sum2(int i) {
    long long rtn = 0;
    for (; i; i -= (i & -i)) {
      rtn += co[i];
    }
    return rtn;
  }
  long long sum2(int l, int r) {
    l++, r++;
    return sum(r) - sum(l - 1);
  }
};
int n, q;
vector<long long> a, w;
fenwick f;
int solve(int l, int r) {
  int lo = l, hi = r, mid;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    if (f.sum(lo, mid) < f.sum(mid + 1, r))
      lo = mid + 1;
    else
      hi = mid;
  }
  return ((f.query(l, lo, a[lo]) - f.query(lo + 1, r, a[lo])) % md + md) % md;
}
void upd(int i, long long val) {
  f.upd(i, -w[i]);
  w[i] = val;
  f.upd(i, w[i]);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> q;
  a.resize(n);
  w.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  long long dec = a[0];
  for (auto &i : a) i -= dec;
  for (auto &i : w) cin >> i;
  f = fenwick(a);
  for (int i = 0; i < n; i++) f.upd(i, w[i]);
  int par[2];
  while (q--) {
    cin >> par[0] >> par[1];
    if (par[0] < 0) {
      par[0] = -par[0];
      --par[0];
      upd(par[0], par[1]);
    } else {
      par[0]--;
      par[1]--;
      cout << solve(par[0], par[1]) << '\n';
    }
  }
}
