#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmin(T &x, const T &y) {
  if (x > y) x = y;
}
template <typename T>
void chmax(T &x, const T &y) {
  if (x < y) x = y;
}
int read() {
  char c;
  while ((c = getchar()) < '-')
    ;
  if (c == '-') {
    int x = (c = getchar()) - '0';
    while ((c = getchar()) >= '0') x = x * 10 + c - '0';
    return -x;
  }
  int x = c - '0';
  while ((c = getchar()) >= '0') x = x * 10 + c - '0';
  return x;
}
const int N = 2e5 + 5, T = N * 3, D = 1e9 + 7;
int b[N];
long long s[T], s2[T];
int n, d;
void modify(int i, int w) {
  i += d;
  s[i] = w;
  s2[i] = (long long)w * b[i - d] % D;
  while (i >>= 1) {
    s[i] = s[(i * 2)] + s[((i * 2) + 1)];
    s2[i] = s2[(i * 2)] + s2[((i * 2) + 1)];
  }
}
long long qiu(int i, int t) {
  if (i == 0) return 0;
  i += d;
  long long a1 = s[i], a2 = s2[i];
  while (i) {
    if (i % 2) {
      a1 += s[i - 1];
      a2 += s2[i - 1];
    }
    i >>= 1;
  }
  return t == 1 ? a1 : a2;
}
int erfen(long long sum) {
  int i = 1;
  while (i <= d)
    if (s[(i * 2)] >= sum)
      i = (i * 2);
    else {
      sum -= s[(i * 2)];
      i = ((i * 2) + 1);
    }
  return i - d;
}
int query(int l, int r) {
  long long sum = qiu(r, 1) - qiu(l - 1, 1);
  int m = erfen((sum + 1) / 2 + qiu(l - 1, 1));
  return ((b[m] * ((qiu(m, 1) - qiu(l - 1, 1) - (qiu(r, 1) - qiu(m, 1))) % D) +
           (qiu(r, 2) - qiu(m, 2) - (qiu(m, 2) - qiu(l - 1, 2)))) %
              D +
          D) %
         D;
}
int main() {
  n = read();
  int m = read();
  for (d = 1; d < n; d *= 2)
    ;
  --d;
  for (int i = 1; i <= n; ++i) b[i] = read() - i;
  for (int i = 1; i <= n; ++i) modify(i, read());
  while (m--) {
    int x = read(), y = read();
    if (x < 0)
      modify(-x, y);
    else
      printf("%d\n", query(x, y));
  }
}
