#include <bits/stdc++.h>
using namespace std;
long long modx(long long Base, long long exponent) {
  long long ans = 1;
  if (Base == 1) return Base;
  while (exponent) {
    if (exponent & 1) ans = (ans * Base) % 1000000007LL;
    Base = (Base * Base) % 1000000007LL;
    exponent = exponent >> 1;
  }
  return ans;
}
long long inmodx(long long num) { return (modx(num, 1000000007LL - 2LL)); }
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.first / 900 < b.first.first / 900) return 1;
  if (a.first.first / 900 > b.first.first / 900) return 0;
  if (a.first.second <= b.first.second) return 1;
  return 0;
}
const int N = (2e5) + 9;
const int M = (N << 2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 450;
long long a[N], w[N], aa[N], BIT[N], BIT2[N];
int n;
void update(int x, long long delta) {
  for (; x <= n; x += x & -x) BIT[x] += delta;
  return;
}
long long query(int x) {
  long long sum = 0;
  for (; x > 0; x -= x & -x) sum += BIT[x];
  return sum;
}
int query(int l, int r) {
  if (l > r) return 0LL;
  return (query(r) - query(l - 1));
}
void update2(int x, long long delta) {
  for (; x <= n; x += x & -x) {
    BIT2[x] += delta;
    if (BIT2[x] >= 1000000007LL) BIT2[x] -= 1000000007LL;
  }
  return;
}
long long query2(int x) {
  long long sum = 0;
  for (; x > 0; x -= x & -x) sum += BIT2[x];
  return (sum % 1000000007LL);
}
int query2(int l, int r) {
  if (l > r) return 0LL;
  return ((query2(r) - query2(l - 1) + 1000000007LL) % 1000000007LL);
}
int binsea(int l, int r, int p, int q, long long val) {
  if (l > r) return q;
  int mid = (l + r) >> 1;
  long long x = query(p, mid);
  if (x >= val - x) return min(mid, binsea(l, mid - 1, p, q, val));
  return binsea(mid + 1, r, p, q, val);
}
void solve() {
  int q, i, l, r, id, x, y;
  long long nw, ans, val;
  cin >> n >> q;
  for (i = (1); i < (n + 1); i++) {
    cin >> a[i];
    a[i] -= i;
    a[i]++;
  }
  for (i = (1); i < (n + 1); i++) {
    cin >> w[i];
    update(i, w[i]);
  }
  for (i = (1); i < (n + 1); i++) {
    aa[i] = (w[i] * a[i]) % 1000000007LL;
    update2(i, aa[i] % 1000000007LL);
  }
  while (q--) {
    cin >> x >> y;
    if (x < 0) {
      id = -x;
      nw = y;
      update(id, nw - w[id]);
      update2(id, (nw * a[id] - aa[id] + 1000000007LL) % 1000000007LL);
      w[id] = nw;
      aa[id] = (w[id] * a[id]) % 1000000007LL;
    } else {
      l = x;
      r = y;
      val = query(l, r);
      id = binsea(l, r, l, r, val);
      ans = (((query(l, id) * a[id]) % 1000000007LL) + 1000000007LL -
             (query2(l, id) % 1000000007LL) -
             ((query(id, r) * a[id]) % 1000000007LL) + 1000000007LL +
             (query2(id, r) % 1000000007LL)) %
            1000000007LL;
      cout << ans << '\n';
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1, cs;
  cout << fixed << setprecision(6);
  for (cs = (1); cs < (t + 1); cs++) {
    solve();
  }
  return 0;
}
