#include <bits/stdc++.h>
using namespace std;
const int mo = 1e9 + 7;
const int maxn = 2e5 + 100;
long long n, Q, x, y, a[maxn], w[maxn], F[maxn], G[maxn], H[maxn], l, r, mid,
    pos, lim, ans;
long long read() {
  int tot = 0, fh = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    tot = tot * 10 + c - '0';
    c = getchar();
  }
  return tot * fh;
}
int lowbit(int x) { return x & -x; }
void modifyF(int x, int y) {
  for (int i = x; i <= n; i += lowbit(i)) F[i] += y;
}
long long queryF(int x) {
  long long res = 0;
  for (int i = x; i > 0; i -= lowbit(i)) res = res + F[i];
  return res;
}
void modifyG(int x, int y) {
  for (int i = x; i <= n; i += lowbit(i)) G[i] += y;
}
long long queryG(int x) {
  long long res = 0;
  for (int i = x; i > 0; i -= lowbit(i)) res = (res + G[i]) % mo;
  return res;
}
void modifyH(int x, int y) {
  for (int i = x; i <= n; i += lowbit(i)) H[i] += y;
}
long long queryH(int x) {
  long long res = 0;
  for (int i = x; i > 0; i -= lowbit(i)) res = (res + H[i]) % mo;
  return res;
}
int main() {
  n = read();
  Q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) {
    w[i] = read();
    modifyF(i, w[i]);
    modifyG(i, (a[i] * w[i]) % mo);
    modifyH(i, (i * w[i]) % mo);
  }
  while (Q) {
    x = read();
    y = read();
    if (x < 0) {
      x = -x;
      modifyF(x, y - w[x]);
      modifyG(x, a[x] * (y - w[x]) % mo);
      modifyH(x, x * (y - w[x]) % mo);
      w[x] = y;
    } else {
      l = x;
      r = y;
      lim = (queryF(y) - queryF(x - 1)) / 2;
      while (l + 1 < r) {
        int mid = (l + r) / 2;
        if (queryF(mid) - queryF(x - 1) <= lim)
          l = mid;
        else
          r = mid - 1;
      }
      if (l + 1 <= y && queryF(l + 1) - queryF(x - 1) <= lim) l++;
      pos = l + 1;
      if (pos > y) pos--;
      ans = 0;
      ans += ((queryF(pos) - queryF(x - 1)) % mo * (a[pos] - pos) % mo -
              (queryG(pos) - queryG(x - 1)) % mo +
              (queryH(pos) - queryH(x - 1)) % mo + mo * 3ll) %
             mo;
      ans += ((queryF(y) - queryF(pos - 1)) % mo * (pos - a[pos]) % mo +
              (queryG(y) - queryG(pos - 1)) % mo -
              (queryH(y) - queryH(pos - 1)) % mo + mo * 3ll) %
             mo;
      ans %= mo;
      cout << ans << "\n";
    }
    Q--;
  }
  return 0;
}
