#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;
long long n, q, a[maxn], w[maxn];
struct BIT {
  long long sum[maxn];
  void update(long long x, long long k) {
    for (long long i = x; i <= n; i += i & (-i)) sum[i] = sum[i] + k;
  }
  long long Query(long long x) {
    long long ans = 0;
    for (long long i = x; i; i -= i & (-i)) ans = ans + sum[i];
    return ans;
  }
  long long Q(long long l, long long r) { return Query(r) - Query(l - 1); }
} 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]), cnt.update(i, (a[i] - i) * w[i]);
  for (long long i = 1; i <= q; i++) {
    long long l = read(), r = read();
    if (l <= 0) {
      l = -l;
      sum.update(l, -w[l]);
      cnt.update(l, -(a[l] - l) * w[l]);
      w[l] = r;
      sum.update(l, w[l]);
      cnt.update(l, (a[l] - l) * w[l]);
    } 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) >= sum.Q(mid + 1, r))
          res = mid, R = mid - 1;
        else
          L = mid + 1;
      }
      L = res;
      ans = (sum.Q(l, L) % mod * (a[L] - L) % mod - cnt.Q(l, L) % mod + mod) %
            mod;
      ans = ((ans + cnt.Q(L, r) % mod) % mod -
             sum.Q(L, r) % mod * (a[L] - L) % mod + mod) %
            mod;
      cout << ans << endl;
    }
  }
  return 0;
}
