#include <bits/stdc++.h>
using namespace std;
int n, q, x[200005], at;
long long y[19][200005], sum, z[19][200005];
int ta, tb;
long long f1(int a, int b, int c, int d) {
  if (((1 << (c)) * (d)) == a && ((1 << (c)) * (d + 1)) == b) return y[c][d];
  c--;
  d = d * 2 + 1;
  if (b <= ((1 << (c)) * (d))) return f1(a, b, c, d - 1);
  if (a >= ((1 << (c)) * (d))) return f1(a, b, c, d);
  return f1(a, ((1 << (c)) * (d)), c, d - 1) + f1(((1 << (c)) * (d)), b, c, d);
}
void f2(int c, int d) {
  if (c == 0) {
    at = d;
    return;
  }
  c--;
  d = d * 2 + 1;
  if (sum < y[c][d - 1])
    f2(c, d - 1);
  else {
    sum -= y[c][d - 1];
    f2(c, d);
  }
}
long long f3(int a, int b, int c, int d) {
  if (((1 << (c)) * (d)) == a && ((1 << (c)) * (d + 1)) == b) return z[c][d];
  c--;
  d = d * 2 + 1;
  if (b <= ((1 << (c)) * (d))) return f3(a, b, c, d - 1);
  if (a >= ((1 << (c)) * (d))) return f3(a, b, c, d);
  return f3(a, ((1 << (c)) * (d)), c, d - 1) + f3(((1 << (c)) * (d)), b, c, d);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", x + i);
    x[i] -= i;
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", y[0] + i);
    z[0][i] = y[0][i] * x[i] % 1000000007;
  }
  for (int i = 1; i < 19; i++)
    for (int j = 0; ((1 << (i)) * (j)) < n; j++) {
      y[i][j] = y[i - 1][j * 2] + y[i - 1][j * 2 + 1];
      z[i][j] = z[i - 1][j * 2] + z[i - 1][j * 2 + 1];
    }
  while (q--) {
    scanf("%d%d", &ta, &tb);
    if (ta < 0) {
      ta = -ta - 1;
      y[0][ta] = tb;
      z[0][ta] = y[0][ta] * x[ta] % 1000000007;
      for (int i = 1; i < 19; i++) {
        ta >>= 1;
        y[i][ta] = y[i - 1][ta * 2] + y[i - 1][ta * 2 + 1];
        z[i][ta] = z[i - 1][ta * 2] + z[i - 1][ta * 2 + 1];
      }
    } else {
      ta--;
      sum = f1(ta, tb, 18, 0) / 2;
      if (ta) sum += f1(0, ta, 18, 0);
      f2(18, 0);
      sum = 0;
      if (ta < at)
        sum = (sum + f1(ta, at, 18, 0) % 1000000007 * x[at] % 1000000007 +
               1000000007 - f3(ta, at, 18, 0) % 1000000007) %
              1000000007;
      if (at < tb)
        sum = (sum + f3(at, tb, 18, 0) % 1000000007 + 1000000007 -
               f1(at, tb, 18, 0) % 1000000007 * x[at] % 1000000007) %
              1000000007;
      printf("%lld\n", sum);
    }
  }
  return 0;
}
