#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const int MAXN = 2e5 + 20;
int a[MAXN], w[MAXN], n;
const int P = 1e9 + 7;
inline void MOD(int& p) {
  while (p < 0) p += P;
  while (p >= P) p -= P;
}
struct BIT1 {
  long long bit[MAXN];
  inline void modify(int w, long long v) {
    while (w <= n) {
      bit[w] += v;
      w += (w & (-w));
    }
  }
  inline long long sum(int w) {
    long long res = 0;
    while (w) {
      res += bit[w];
      w -= (w & (-w));
    }
    return res;
  }
  inline long long query(int l, int r) { return sum(r) - sum(l - 1); }
} BitW;
struct BIT2 {
  int bit[MAXN];
  inline void modify(int w, int v) {
    while (w <= n) {
      MOD(bit[w] += v);
      w += (w & (-w));
    }
  }
  inline int sum(int w) {
    MOD(w);
    long long res = 0;
    while (w) {
      res += bit[w];
      w -= (w & (-w));
    }
    return res % P;
  }
  inline int query(int l, int r) { return (sum(r) - sum(l - 1) + P) % P; }
} BitS;
inline int getAns(int l, int r) {
  int L = l, R = r;
  while (L <= R) {
    int mid = (L + R) >> 1;
    if (BitW.query(l, mid) >= BitW.query(mid + 1, r)) {
      R = mid - 1;
    } else {
      L = mid + 1;
    }
  }
  ++R;
  long long res = 0;
  res = -BitS.query(l, R) + BitW.query(l, R) % P * abs(a[R] - R) % P;
  res = (res % P + P) % P;
  res -= -BitS.query(R, r) + BitW.query(R, r) % P * abs(a[R] - R) % P;
  res = (res % P + P) % P;
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int q;
  cin >> n >> q;
  for (register int i = (1); i <= (n); ++i) {
    cin >> a[i];
  }
  for (register int i = (1); i <= (n); ++i) {
    cin >> w[i];
    BitW.modify(i, w[i]);
    BitS.modify(i, 1ll * w[i] * (a[i] - i) % P);
  }
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (l < 0) {
      l = -l;
      BitW.modify(l, -w[l]);
      BitS.modify(l, -1ll * w[l] * (a[l] - l) % P);
      w[l] = r;
      BitW.modify(l, w[l]);
      BitS.modify(l, 1ll * w[l] * (a[l] - l) % P);
    } else {
      cout << getAns(l, r) << '\n';
    }
  }
  return 0;
}
