#include <bits/stdc++.h>
using namespace std;
long long inline read() {
  long long num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
const long long maxn = 200010, mod = 1e9 + 7, M = 1e9, xscakioi = 1;
long long n, q, a[maxn], w[maxn];
struct BIT {
  long long sum[maxn];
  void update(long long x, long long k, long long op) {
    for (long long i = x; i <= n; i += i & (-i)) {
      sum[i] = sum[i] + k;
      if (op) sum[i] %= mod;
    }
  }
  long long Query(long long x, long long op) {
    long long ans = 0;
    for (long long i = x; i; i -= i & (-i)) {
      ans = ans + sum[i];
      if (op) ans %= mod;
    }
    return ans;
  }
  long long Q(long long l, long long r, long long op) {
    long long ans = Query(r, op) - Query(l - 1, op);
    if (op) ans = (ans + mod) % mod;
    return ans;
  }
} sum, cnt;
signed main() {
  n = read();
  q = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= n; i++) w[i] = read();
  for (long long i = 1; i <= n; i++)
    sum.update(i, w[i], 0), cnt.update(i, (a[i] - i) * w[i], 1);
  for (long long i = 1; i <= q; i++) {
    long long l = read(), r = read();
    if (l <= 0) {
      l = -l;
      sum.update(l, -w[l], 0);
      cnt.update(l, -(a[l] - l) * w[l], 1);
      w[l] = r;
      sum.update(l, w[l], 0);
      cnt.update(l, (a[l] - l) * w[l], 1);
    } else {
      if (l == r) {
        cout << 0 << endl;
        continue;
      }
      long long L = l, R = r, ans = 0, res;
      while (L <= R) {
        long long mid = L + R >> 1;
        if (sum.Q(l, mid, 0) >= sum.Q(mid + 1, r, 0))
          res = mid, R = mid - 1;
        else
          L = mid + 1;
      }
      L = res;
      ans = (sum.Q(l, L, 1) % mod * (a[L] - L) % mod - cnt.Q(l, L, 1) % mod +
             mod) %
            mod;
      ans = ((ans + cnt.Q(L, r, 1) % mod) % mod -
             sum.Q(L, r, 1) % mod * (a[L] - L) % mod + mod) %
            mod;
      cout << (ans + mod) % mod << endl;
    }
  }
  return 0;
}
