#include <bits/stdc++.h>
using namespace std;
void add(long long &a, long long b) {
  a += b;
  if (a > 1000000007) a -= 1000000007;
}
int N, Q, a[200200];
long long w[200200];
struct modtree {
  long long t[200200];
  void u(int i, long long v) {
    i++;
    v %= 1000000007;
    for (; i <= N; i += (i & -i)) add(t[i], v);
  }
  long long gtv(int i) {
    i++;
    long long res = 0;
    for (; i > 0; i -= (i & -i)) add(res, t[i]);
    return res;
  }
  long long q(int l, int r) {
    return (gtv(r) - gtv(l - 1) + 1000000007) % 1000000007;
  }
} awt, wit;
struct tree {
  long long t[200200];
  void u(int i, long long v) {
    i++;
    for (; i <= N; i += (i & -i)) t[i] += v;
  }
  long long gtv(int i) {
    i++;
    long long res = 0;
    for (; i > 0; i -= (i & -i)) res += t[i];
    return res;
  }
  long long q(int l, int r) { return gtv(r) - gtv(l - 1); }
} wt;
long long dif(int l, int r, int s) {
  if (l > r) return 0ll;
  long long wi_tot = wit.q(l, r);
  long long wt_tot = wt.q(l, r) % 1000000007;
  wi_tot = (wi_tot + wt_tot * s) % 1000000007;
  long long aw_tot = awt.q(l, r);
  return (wi_tot - aw_tot + 1000000007) % 1000000007;
}
long long delta(int l, int r, int s) {
  int lo = l, hi = r, split = l - 1;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (a[mid] <= s + mid)
      lo = mid + 1, split = mid;
    else
      hi = mid - 1;
  }
  long long d = 0;
  if (l <= split) d += wt.q(l, split);
  if (split + 1 <= r) d -= wt.q(split + 1, r);
  return d;
}
long long dis(int l, int r, int s) {
  int lo = l, hi = r, split = l - 1;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (a[mid] <= s + mid)
      lo = mid + 1, split = mid;
    else
      hi = mid - 1;
  }
  long long lft = dif(l, split, s);
  long long rgt = dif(split + 1, r, s);
  return (lft - rgt + 1000000007) % 1000000007;
}
int main() {
  scanf("%d %d", &N, &Q);
  for (int i = (0); i < (N); i++) scanf("%d", &a[i]);
  for (int i = (0); i < (N); i++) {
    scanf("%lld", &w[i]);
    wt.u(i, w[i]);
    awt.u(i, w[i] * a[i] % 1000000007);
    wit.u(i, w[i] * i % 1000000007);
  }
  for (int i = (0); i < (Q); i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x < 0) {
      x = -x - 1;
      wt.u(x, y - w[x]);
      long long dif = ((long long)y - w[x] + 1000000007) % 1000000007;
      w[x] = (long long)y;
      awt.u(x, dif * a[x] % 1000000007);
      wit.u(x, dif * x % 1000000007);
    } else {
      x--, y--;
      int lo = 1, hi = (int)1e9, ans = -1;
      while (lo <= hi) {
        int mid = (lo + hi) / 2;
        long long res = delta(x, y, mid);
        if (res >= 0) {
          hi = mid - 1;
          ans = mid;
        } else
          lo = mid + 1;
      }
      long long u = dis(x, y, ans);
      printf("%lld\n", u);
    }
  }
  return 0;
}
