#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Cin(T &x) {
  register char c;
  bool neg = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') neg = 1;
  for (x = 0; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  if (neg) x = -x;
}
template <typename T>
inline void Cout(T x) {
  if (x > 9) Cout(x / 10);
  putchar(x % 10 + '0');
}
const int Mod = 1e9 + 7, maxN = 2e5 + 2;
int a[maxN], w[maxN], n, p1, q, l, r;
struct TBIT1 {
  long long lab[maxN];
  inline void Init() { memset(lab, 0, sizeof lab); }
  inline void Update(int i, int val) {
    for (; i <= n; i += i & -i) lab[i] += val;
  }
  inline long long Get(int i) {
    long long res = 0;
    for (; i > 0; i &= i - 1) res += lab[i];
    return res;
  }
  inline int Find(long long t) {
    int x = 0, y;
    for (int p = p1; p > 0; p >>= 1) {
      y = x + p;
      if (y <= n && lab[y] <= t) x = y, t -= lab[x];
    }
    return x;
  }
} BIT1;
struct TBIT2 {
  int lab[maxN];
  inline void Init() { memset(lab, 0, sizeof lab); }
  inline void Update(int i, int val) {
    for (; i <= n; i += i & -i)
      if ((lab[i] += val) >= Mod) lab[i] -= Mod;
  }
  inline int Get(int i) {
    int res = 0;
    for (; i > 0; i &= i - 1)
      if ((res += lab[i]) >= Mod) res -= Mod;
    return res;
  }
} BIT2;
void Inp() {
  Cin(n);
  Cin(q);
  BIT1.Init();
  BIT2.Init();
  for (p1 = 1; p1 << 1 <= n; p1 <<= 1)
    ;
  for (int i = 1; i <= n; ++i) Cin(a[i]), a[i] -= i;
  for (int i = 1; i <= n; ++i) {
    Cin(w[i]);
    BIT1.Update(i, w[i]);
    BIT2.Update(i, a[i] * (long long)w[i] % Mod);
  }
}
void Solve() {
  while (--q >= 0) {
    Cin(l);
    Cin(r);
    if (l < 0) {
      l = -l;
      BIT1.Update(l, r - w[l]);
      BIT2.Update(l, long long(r - w[l] + Mod) * a[l] % Mod);
      w[l] = r;
    } else {
      long long wl1 = BIT1.Get(l - 1), wlr = BIT1.Get(r) - wl1;
      long long key = (wlr >> 1) + wl1;
      int pos = BIT1.Find(key - 1);
      long long ans = -(BIT2.Get(pos) - BIT2.Get(l - 1)) -
                      a[pos + 1] * (key - BIT1.Get(pos));
      key += 1 + (wlr & 1);
      pos = BIT1.Find(key - 1) + 1;
      if (pos < r) ans += BIT2.Get(r) - BIT2.Get(pos);
      ans += a[pos] * (BIT1.Get(pos) - key + 1);
      cout << (ans + (long long)Mod * Mod + Mod) % Mod << '\n';
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Inp();
  Solve();
  return 0;
}
