#include <bits/stdc++.h>
using i64 = long long;
template <class T = long long int>
class Bit {
 private:
  unsigned len;
  T init;
  std::vector<T> arr;

 public:
  Bit(unsigned length, T initialValue = 0)
      : len(length), init(initialValue), arr(len + 1, init) {}
  void update(unsigned a, T newval) {
    for (unsigned x = a; x <= len; x += x & -x) arr[x] += newval;
  }
  T query(unsigned a) const {
    T ret = init;
    for (unsigned x = a; x > 0; x -= x & -x) ret += arr[x];
    return ret;
  }
};
int main() {
  constexpr i64 mod = 1000000007;
  int n, q;
  scanf("%d%d", &n, &q);
  std::vector<i64> a(n), w(n);
  for (auto &e : a) scanf("%lld", &e);
  for (int i = 0; i < n; i++) a[i] -= i;
  for (auto &e : w) scanf("%lld", &e);
  Bit<> ss(n + 10), pr(n + 10);
  for (int i = 0; i < n; i++) {
    ss.update(i + 1, w[i]);
    pr.update(i + 1, w[i] * a[i] % mod);
  }
  while (q--) {
    i64 x, y;
    scanf("%lld%lld", &x, &y);
    if (x < 0) {
      const int i = -x - 1;
      ss.update(i + 1, y - w[i]);
      pr.update(i + 1, y * a[i] % mod - w[i] * a[i] % mod);
      w[i] = y;
    } else {
      if (x == y) {
        printf("0\n");
        continue;
      }
      int l = x - 1, r = y;
      const i64 lb = ss.query(x - 1), sum = ss.query(y) - lb;
      while (r - l > 1) {
        const int k = (l + r) / 2;
        const i64 s = ss.query(k + 1) - lb;
        if (2 * s <= sum)
          l = k;
        else
          r = k;
      }
      if (l + 1 < y) ++l;
      const i64 lss = (ss.query(l) % mod + mod - lb % mod) % mod * a[l] % mod,
                rss = (ss.query(y) % mod + mod - ss.query(l) % mod) % mod *
                      a[l] % mod,
                lpr = (pr.query(l) % mod + mod - pr.query(x - 1) % mod) % mod,
                rpr = (pr.query(y) % mod + mod - pr.query(l) % mod) % mod;
      const i64 ret = (lss - lpr + 2 * mod + rpr - rss) % mod;
      printf("%lld\n", ret);
    }
  }
  return 0;
}
