#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}
template <typename T, typename... U>
inline void read(T& x, U&... y) {
  read(x), read(y...);
}
const int N = 2e5 + 10, P = 1e9 + 7;
int n, Q;
int A[N], W[N];
long long X[N], S[N], G[N];
void Modify(int pos, int val) {
  while (pos <= n) {
    X[pos] += val;
    pos += (pos & -pos);
  }
}
long long Sum(int pos) {
  long long res = 0;
  while (pos) {
    res += X[pos];
    pos -= (pos & -pos);
  }
  return res;
}
void ADD(int pos, int val) {
  while (pos <= n) {
    S[pos] += val;
    if (S[pos] >= P) S[pos] -= P;
    pos += (pos & -pos);
  }
}
long long Get(int pos) {
  long long res = 0;
  while (pos) {
    res += S[pos];
    if (res >= P) res -= P;
    pos -= (pos & -pos);
  }
  return res;
}
void Update(int pos, int val) {
  while (pos <= n) {
    G[pos] += val;
    if (S[pos] >= P) G[pos] -= P;
    pos += (pos & -pos);
  }
}
long long Calc(int pos) {
  long long res = 0;
  while (pos) {
    res += G[pos];
    if (res >= P) res -= P;
    pos -= (pos & -pos);
  }
  return res;
}
int Find(int l, int r, long long x, long long Sl) {
  if (l == r) return l;
  int mid = l + r >> 1;
  long long t = Sum(mid) - Sl;
  if (t >= x - t) return Find(l, mid, x, Sl);
  return Find(mid + 1, r, x, Sl);
}
int Query(int l, int r) {
  if (l == r) return 0;
  int p = Find(l, r, Sum(r) - Sum(l - 1), Sum(l - 1));
  long long SUM = (Sum(p) - Sum(l - 1)) % P, S1 = 1ll * A[p] * SUM % P,
            S2 = 1ll * p * SUM % P, S3 = (Calc(p) - Calc(l - 1)) % P,
            S4 = (Get(p) - Get(l - 1)) % P;
  long long t1 = ((S1 - S2 + S3 - S4) % P + P) % P;
  SUM = (Sum(r) - Sum(p)) % P, S1 = (Get(r) - Get(p)) % P,
  S2 = 1ll * A[p] * SUM % P, S3 = (Calc(r) - Calc(p)) % P,
  S4 = 1ll * p * SUM % P;
  long long t2 = ((S1 - S2 - S3 + S4) % P + P) % P;
  return (t1 + t2) % P;
}
int main() {
  read(n, Q);
  for (int i = 1; i <= n; ++i) read(A[i]);
  for (int i = 1; i <= n; ++i)
    read(W[i]), Modify(i, W[i]), ADD(i, 1ll * W[i] * A[i] % P),
        Update(i, 1ll * i * W[i] % P);
  while (Q--) {
    int l, r;
    read(l, r);
    if (l < 0)
      Modify(-l, r - W[-l]), ADD(-l, (1ll * (r - W[-l]) * A[-l] % P + P) % P),
          Update(-l, (1ll * (r - W[-l]) * (-l) % P + P) % P), W[-l] = r;
    else
      printf("%d\n", Query(l, r));
  }
  return 0;
}
