#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Cin(T &x) {
  char c;
  T sign = 1;
  x = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sign;
}
const int N = 2e5 + 7;
const int mod = 1e9 + 7;
long long a[N], w[N];
int n, l, r, q;
struct FenwickWeight {
  long long t[N];
  void Init(int n) { fill_n(t, n + 5, 0); }
  void Update(int x, long long val) {
    if (x <= 0) return;
    for (; x <= n; x += (x & -x)) t[x] += val;
  }
  long long Get(int x) {
    if (x <= 0) return 0;
    long long res = 0;
    for (; x > 0; x -= (x & -x)) res += t[x];
    return res;
  }
  long long GetSum(int l, int r) {
    if (l > r) return 0;
    return Get(r) - Get(l - 1);
  }
  int Find(long long x) {
    int res = n + 1, cur = 0, mask = 1;
    while (mask <= n) mask <<= 1;
    while (mask > 0) {
      if ((cur | mask) <= n) {
        if (t[cur | mask] >= x)
          res = cur | mask;
        else {
          cur |= mask;
          x -= t[cur];
        }
      }
      mask >>= 1;
    }
    return res;
  }
} tw;
struct FenwickWA {
  long long t[N];
  void Init(int n) { fill_n(t, n + 5, 0); }
  void Update(int x, long long val) {
    if (x <= 0) return;
    for (; x <= n; x += (x & -x)) t[x] = (t[x] + val) % mod;
  }
  long long Get(int x) {
    if (x <= 0) return 0;
    long long res = 0;
    for (; x > 0; x -= (x & -x)) res = (res + t[x]) % mod;
    return res;
  }
  long long GetSum(int l, int r) {
    if (l > r) return 0;
    return ((Get(r) - Get(l - 1)) % mod + mod) % mod;
  }
} twa;
void Enter() {
  Cin(n);
  Cin(q);
  for (int i = 1; i <= n; ++i) Cin(a[i]), a[i] -= i;
  for (int i = 1; i <= n; ++i) {
    Cin(w[i]);
    tw.Update(i, w[i]);
    twa.Update(i, (w[i] * a[i]) % mod);
  }
}
void Update(int l, long long r) {
  tw.Update(l, r - w[l]);
  twa.Update(l, (((r - w[l]) * a[l]) % mod + mod) % mod);
  w[l] = r;
}
int Query(int l, int r) {
  long long s = tw.GetSum(l, r);
  int p = tw.Find((s & 1) + (s >> 1) + tw.Get(l - 1));
  long long lef = (tw.GetSum(l, p - 1) * a[p] - twa.GetSum(l, p - 1)) % mod;
  long long rig = (twa.GetSum(p, r) - tw.GetSum(p, r) * a[p]) % mod;
  return (((rig + lef) % mod) + mod) % mod;
}
void Solve() {
  for (int i = 1; i <= q; ++i) {
    Cin(l);
    Cin(r);
    if (l <= 0)
      Update(-l, r);
    else
      cout << Query(l, r) << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Enter();
  Solve();
  return 0;
}
