#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void pre() {}
void solve() {}
const long long mod = 1e9 + 7;
struct FT {
  vector<long long> s;
  FT(int n) : s(n, 0) {}
  void update(int pos, long long dif) {
    for (; pos < (int)(s).size(); pos |= pos + 1) s[pos] += dif;
  }
  long long query(int pos) {
    long long res = 0;
    for (; pos > 0; pos &= pos - 1) res += s[pos - 1];
    return res;
  }
};
struct Node {
  Node *l = 0, *r = 0;
  int lo, hi;
  long long madd = 0, val = 0, d;
  Node(vector<int>& v, int lo, int hi) : lo(lo), hi(hi) {
    if (lo + 1 < hi) {
      int mid = lo + (hi - lo) / 2;
      l = new Node(v, lo, mid);
      r = new Node(v, mid, hi);
      d = (l->d + r->d) % mod;
    } else
      d = v[lo];
  }
  long long query(int L, int R) {
    if (R <= lo || hi <= L) return 0;
    if (L <= lo && hi <= R) return val;
    push();
    return (l->query(L, R) + r->query(L, R)) % mod;
  }
  void add(int L, int R, long long x) {
    if (R <= lo || hi <= L) return;
    if (L <= lo && hi <= R) {
      madd += x;
      val += x * d % mod;
      madd %= mod;
      val %= mod;
    } else {
      push(), l->add(L, R, x), r->add(L, R, x);
      val = (l->val + r->val) % mod;
    }
  }
  void push() {
    if (madd) l->add(lo, hi, madd), r->add(lo, hi, madd), madd = 0;
  }
};
long long a[200009], w[200009];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  pre();
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < (n); ++i) cin >> a[i];
  for (int i = 0; i < (n); ++i) cin >> w[i];
  FT T1(n + 3), T2(n + 3), T3(n + 3), T4(n + 3);
  long long sum = 0;
  vector<int> d(n - 1);
  for (int i = 0; i < (n - 1); ++i)
    d[i] = a[i + 1] - a[i] - 1, T4.update(i, d[i]);
  Node N1(d, 0, n), N2(d, 0, n);
  for (int i = 0; i < (n - 1); ++i) {
    sum += w[i];
    sum %= mod;
    T1.update(i, (a[i + 1] - a[i] - 1) * sum % mod);
  }
  sum = 0;
  for (int i = n - 2; i >= (0); --i) {
    sum += w[i + 1];
    sum %= mod;
    T2.update(i + 1, (a[i + 1] - a[i] - 1) * sum % mod);
  }
  for (int i = 0; i < (n); ++i) {
    T3.update(i, w[i]);
  }
  for (int i = 0; i < (q); ++i) {
    int l, r;
    cin >> l >> r;
    if (l < 0) {
      long long dif = r - w[-l];
      dif %= mod;
      w[-l] = r;
      int ix = -l;
      ix--;
      if (ix > 0) {
        N2.add(0, ix, dif);
      }
      if (ix < n - 1) {
        N1.add(ix, n, dif);
      }
      T3.update(ix, dif);
    } else {
      l--, r--;
      int lo = l, hi = r;
      while (lo < hi) {
        int m = (lo + hi) / 2;
        if (T3.query(r + 1) - T3.query(m + 1) >=
            T3.query(m + 1) - T3.query(l)) {
          lo = m + 1;
        } else
          hi = m;
      }
      long long ans =
          T2.query(r + 1) - T2.query(lo + 1) + T1.query(lo) - T1.query(l) -
          (T4.query(lo) - T4.query(l)) * T3.query(l) % mod -
          (T4.query(r) - T4.query(lo)) * (T3.query(n) - T3.query(r + 1)) % mod;
      ans += N1.query(l, lo) + N2.query(lo, r);
      ans = (ans % mod + mod) % mod;
      cout << ans << '\n';
    }
  }
  return 0;
}
