#include <bits/stdc++.h>
inline int readChar();
template <class T = int>
inline T readInt();
template <class T>
inline void writeInt(T x, char end = 0);
inline void writeChar(int x);
inline void writeWord(const char *s);
static const int buf_size = 4096;
inline int getChar() {
  static char buf[buf_size];
  static int len = 0, pos = 0;
  if (pos == len) pos = 0, len = fread(buf, 1, buf_size, stdin);
  if (pos == len) return -1;
  return buf[pos++];
}
inline int readChar() {
  int c = getChar();
  while (c <= 32) c = getChar();
  return c;
}
template <class T>
inline T readInt() {
  int s = 1, c = readChar();
  T x = 0;
  if (c == '-') s = -1, c = getChar();
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getChar();
  return s == 1 ? x : -x;
}
static int write_pos = 0;
static char write_buf[buf_size];
inline void writeChar(int x) {
  if (write_pos == buf_size)
    fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
  write_buf[write_pos++] = x;
}
template <class T>
inline void writeInt(T x, char end) {
  if (x < 0) writeChar('-'), x = -x;
  char s[24];
  int n = 0;
  while (x || !n) s[n++] = '0' + x % 10, x /= 10;
  while (n--) writeChar(s[n]);
  if (end) writeChar(end);
}
inline void writeWord(const char *s) {
  while (*s) writeChar(*s++);
}
struct Flusher {
  ~Flusher() {
    if (write_pos) fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
  }
} flusher;
inline void readWord(char *s) {
  int c = readChar();
  while (c > 32) *s++ = c, c = getChar();
  *s = 0;
}
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using ull = unsigned long long;
const int maxn = 2e5;
const int mod = 998244353;
const int M = 1e9 + 7;
const int inf = 1e4;
const ll inf64 = 3e18L;
const ld pi = acos((ld)-1.0);
const ld eps = (ld)1e-6;
const int di[] = {0, 0, 1, -1, 0};
const int dj[] = {1, -1, 0, 0, 0};
const int SQ = 1000;
struct utree {
  int n;
  vll t;
  utree(int n) : n(n), t(2 * n, 0) {}
  void upd(int v, ll first) {
    t[v += n] = first;
    for (v >>= 1; v; v >>= 1) t[v] = t[v * 2] + t[v * 2 + 1];
  }
  ll get(int l, int r) {
    ll ret = 0;
    for (l += n, r += n; l <= r; l = (l + 1) >> 1, r = (r - 1) >> 1) {
      if (l & 1) ret += t[l];
      if (!(r & 1)) ret += t[r];
    }
    return ret;
  }
};
struct tree {
  int n;
  vll t;
  tree(int n) : n(n), t(2 * n, 0) {}
  void upd(int v, ll first) {
    first %= M;
    t[v += n] = first;
    for (v >>= 1; v; v >>= 1) t[v] = (t[v * 2] + t[v * 2 + 1]) % M;
  }
  ll get(int l, int r) {
    ll ret = 0;
    for (l += n, r += n; l <= r; l = (l + 1) >> 1, r = (r - 1) >> 1) {
      if (l & 1) ret = (ret + t[l]) % M;
      if (!(r & 1)) ret = (ret + t[r]) % M;
    }
    return ret;
  }
};
int n, q, a[maxn], w[maxn];
utree t1(maxn);
tree t2(maxn);
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i], a[i] -= i;
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) {
    t1.upd(i, w[i]);
    t2.upd(i, (ll)a[i] * w[i]);
  }
  while (q--) {
    int first, second;
    cin >> first >> second;
    if (first < 0) {
      first = -first - 1;
      t1.upd(first, second);
      t2.upd(first, (ll)a[first] * second);
    } else {
      first--;
      second--;
      int lf = first, rg = second;
      while (lf < rg) {
        int md = (lf + rg) >> 1;
        if (1ULL * (md - first + 1) * t1.get(first, md) >
            1ULL * (second - md) * t1.get(md + 1, second))
          rg = md;
        else
          lf = md + 1;
      }
      cout << ((1LL * a[lf] * (t1.get(first, lf) % M) - t2.get(first, lf) +
                t2.get(lf + 1, second) -
                1LL * a[lf] * (t1.get(lf + 1, second) % M)) %
                   M +
               M) %
                  M
           << '\n';
    }
  }
}
