#include <bits/stdc++.h>
using ul = std::uint32_t;
using ull = std::uint64_t;
using li = std::int32_t;
using ll = std::int64_t;
using vull = std::vector<ull>;
using vul = std::vector<ul>;
const ul sz = 1 << 18;
const ul base = 1e9 + 7;
class scaler {
 public:
  ul v = 0;
  scaler() = default;
  scaler(ul x) : v(x) {}
};
scaler operator+(scaler a, scaler b) {
  return scaler(a.v + b.v < base ? a.v + b.v : a.v + b.v - base);
}
scaler operator-(scaler a, scaler b) {
  return scaler(a.v < b.v ? a.v + base - b.v : a.v - b.v);
}
scaler operator*(scaler a, scaler b) { return scaler(ull(a.v) * b.v % base); }
template <typename T>
void change(ul pos, const T& v, std::vector<T>& tree) {
  for (tree[pos |= sz] = v, pos >>= 1; pos; pos >>= 1) {
    tree[pos] = tree[pos << 1] + tree[pos << 1 | 1];
  }
}
template <typename T>
T query(ul l, ul r, const std::vector<T>& tree) {
  T ret = 0;
  for (l = l - 1 | sz, r = r + 1 | sz; l ^ r ^ 1; l >>= 1, r >>= 1) {
    if (~l & 1) {
      ret = ret + tree[l ^ 1];
    }
    if (r & 1) {
      ret = ret + tree[r ^ 1];
    }
  }
  return ret;
}
std::vector<scaler> atree(sz << 1, ul(0));
vull tree(sz << 1, ul(0));
ul n, q;
vul a(2e5 + 1);
scaler compute(ul l, ul r, ul cut) {
  return scaler(query(l, cut - 1, tree) % base) * scaler(a[cut]) -
         query(l, cut - 1, atree) + query(cut + 1, r, atree) -
         scaler(query(cut + 1, r, tree) % base) * scaler(a[cut]);
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cin >> n >> q;
  for (ul i = 1; i <= n; ++i) {
    std::cin >> a[i];
    a[i] -= i;
  }
  for (ul i = 1; i <= n; ++i) {
    ul w;
    std::cin >> w;
    change(i, ull(w), tree);
    change(i, scaler(a[i]) * scaler(w), atree);
  }
  for (ul i = 0; i != q; ++i) {
    li x, y;
    std::cin >> x >> y;
    if (x < 0) {
      ul id = -x;
      ul w = y;
      change(id, ull(w), tree);
      change(id, scaler(a[id]) * scaler(w), atree);
    } else {
      ul l = x, r = y;
      ull temp = query(l, r, tree);
      ul lans = l, rans = r + 1;
      while (lans + 1 != rans) {
        ul mid = lans + rans >> 1;
        if ((query(mid, r, tree) << 1) < temp) {
          rans = mid;
        } else {
          lans = mid;
        }
      }
      std::cout << compute(l, r, lans).v << std::endl;
    }
  }
  return 0;
}
