#include <bits/stdc++.h>
using namespace std;
int n, q, l, r, id, i, x, y;
long long nw;
long long p = 1e9 + 7;
long long a[200005];
long long w[200005];
long long t1[200005];
long long t2[200005];
int lowbit(int x) { return x & -x; }
void ud_t1(int x, long long dt) {
  int i;
  for (i = x; i <= n; i += lowbit(i)) t1[i] += dt;
}
void ud_t2(int x, long long dt) {
  int i;
  for (i = x; i <= n; i += lowbit(i)) t2[i] += dt, t2[i] = (t2[i] % p + p) % p;
}
long long query_t1(int x) {
  int i;
  long long ans = 1ll * 0;
  for (i = x; i; i -= lowbit(i)) ans += t1[i];
  return ans;
}
long long query_t2(int x) {
  int i;
  long long ans = 1ll * 0;
  for (i = x; i; i -= lowbit(i)) ans += t2[i], ans = (ans % p + p) % p;
  return ans;
}
long long sum_t1(int l, int r) { return query_t1(r) - query_t1(l - 1); }
long long sum_t2(int l, int r) {
  return ((query_t2(r) - query_t2(l - 1)) % p + p) % p;
}
long long find(int L, int R) {
  int l = L, r = R;
  int m;
  while (l < r) {
    m = (l + r) >> 1;
    if (sum_t1(L, m) >= sum_t1(m + 1, R))
      r = m;
    else
      l = m + 1;
  }
  return l;
}
int main() {
  scanf("%d%d", &n, &q);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = 1; i <= n; i++) scanf("%lld", &w[i]);
  for (i = 1; i <= n; i++)
    ud_t1(i, w[i]), ud_t2(i, 1ll * w[i] * (a[i] - i) % p);
  long long loc;
  long long ans;
  while (q--) {
    scanf("%d%d", &x, &y);
    if (x < 0) {
      id = -x, nw = 1ll * y;
      long long dt1 = nw - w[id];
      w[id] = nw;
      ud_t1(id, dt1);
      long long dt2 = 1ll * dt1 * (a[id] - id) % p;
      ud_t2(id, dt2);
    } else {
      l = x, r = y;
      loc = find(l, r);
      ans = 1ll * (a[loc] - loc) % p * (sum_t1(l, loc - 1) % p) % p;
      ans -= 1ll * ((sum_t2(l, loc - 1) % p + p) % p);
      ans %= p;
      ans += 1ll * ((sum_t2(loc + 1, r) % p + p) % p);
      ans %= p;
      ans -= 1ll * (a[loc] - loc) % p * (sum_t1(loc + 1, r) % p) % p;
      ans = (ans % p + p) % p;
      printf("%lld\n", ans);
    }
  }
  return 0;
}
