#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
int n, l, r;
long long S[maxn << 1], wp[maxn << 1], owp[maxn], os[maxn], ps[maxn];
long long add(long long a, long long b) {
  if (a + b > mod)
    return a + b - mod;
  else
    return a + b;
}
int lowbit(int x) { return x & (-x); }
void change1(int p, int x) {
  while (p <= n) {
    S[p] += x;
    p += lowbit(p);
  }
}
void change2(int p, int x) {
  while (p <= n) {
    wp[p] = add(x, wp[p]);
    p += lowbit(p);
  }
}
long long ssum(int k) {
  long long ans = 0;
  while (k > 0) {
    ans += S[k];
    k -= lowbit(k);
  }
  return ans;
}
int wpsum(int k) {
  long long ans = 0;
  while (k > 0) {
    ans = add(ans, wp[k]);
    k -= lowbit(k);
  }
  if (ans > mod || ans < -mod)
    return ans % mod;
  else
    return ans;
}
long long ask(int l, int r, int op) {
  if (op == 1)
    return ssum(r) - ssum(l - 1);
  else
    return wpsum(r) - wpsum(l - 1);
}
int findk(int l, int r) {
  int L = l, R = r, mid;
  double al = 1.0 * (ask(l, r, 1)) / 2;
  while (L < R) {
    mid = (L + R) >> 1;
    if (ask(l, mid, 1) >= al)
      R = mid;
    else
      L = mid + 1;
  }
  return L;
}
int main() {
  int q, a, b, pos;
  long long nw, n1, n2;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%lld", &ps[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &os[i]);
    owp[i] = (ps[i] - i) * os[i];
    if (owp[i] > mod) owp[i] %= mod;
    change1(i, os[i]);
    change2(i, owp[i]);
  }
  while (q--) {
    scanf("%d%d", &a, &b);
    if (a < 0) {
      pos = -a, nw = b;
      n1 = nw - os[pos], n2 = (nw * (ps[pos] - pos) - owp[pos]) % mod;
      os[pos] = b;
      owp[pos] = nw * (ps[pos] - pos);
      change1(pos, n1);
      change2(pos, n2);
    } else {
      int k = findk(a, b);
      l = a, r = b;
      long long ans = ((ask(l, k, 1) - ask(k, r, 1)) * (ps[k] - k) -
                       (ask(l, k, 2) - ask(k, r, 2))) %
                      mod;
      printf("%lld\n", (ans % mod + mod) % mod);
    }
  }
  return 0;
}
