#include <bits/stdc++.h>
const int N = 200005, mod = 1000000007;
int n, q, a[N], b[N], w[N];
void up(long long &x, int y) { x += y - mod, x += x >> 63 & mod; }
void up(long long &x, int y, int z) { x = (x + (long long)y * z) % mod; }
long long bit0[N], bit1[N];
void modify(int x, int d) {
  int y = (long long)(d + mod) * (b[x] + mod) % mod;
  for (; x <= n; x += x & -x) bit0[x] += d, up(bit1[x], y);
}
long long query(long long *bit, int l, int r) {
  long long ans = 0;
  for (; r; r &= r - 1) ans += bit[r];
  for (--l; l; l &= l - 1) ans -= bit[l];
  return ans;
}
int query(int l, int r) {
  int L = l, R = r, ans = -1;
  long long sum = query(bit0, l, r);
  while (L <= R) {
    int mid = L + R >> 1;
    if (2 * query(bit0, l, mid) >= sum)
      ans = mid, R = mid - 1;
    else
      L = mid + 1;
  }
  int x = (b[ans] + mod) % mod;
  int left = query(bit0, l, ans - 1) % mod;
  int right = query(bit0, ans + 1, r) % mod;
  int _left = query(bit1, l, ans - 1) % mod;
  int _right = query(bit1, ans + 1, r) % mod;
  return (mod - _left + (long long)x * left + (long long)(mod - x) * right +
          _right) %
         mod;
}
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> n >> q;
  for (int i = 1; i <= n; ++i) std::cin >> a[i], b[i] = a[i] - i;
  for (int i = 1; i <= n; ++i) std::cin >> w[i];
  for (int i = 1; i <= n; ++i)
    bit0[i] = w[i], bit1[i] = (long long)w[i] * (a[i] - i + mod) % mod;
  for (int i = 1; i <= n; ++i) {
    int j = i + (i & -i);
    if (j <= n) bit0[j] += bit0[i], up(bit1[j], bit1[i]);
  }
  while (q--) {
    int x, y;
    std::cin >> x >> y;
    if (x < 0)
      modify(-x, y - w[-x]), w[-x] = y;
    else
      std::cout << query(x, y) << '\n';
  }
  return 0;
}
