#include <bits/stdc++.h>
using namespace std;
int const N = 200000, md = 1e9 + 7;
int a[N + 1], n, q, aw[N + 1];
long long fn[N + 1];
void ad(int &x, int y) {
  if ((x += y) >= md) x -= md;
}
void sb(int &x, int y) {
  if ((x -= y) < 0) x += md;
}
void adf(int i, int x) {
  while (i <= n) fn[i] += x, i += i & -i;
}
long long gt(int i) {
  long long an = 0;
  while (i) an += fn[i], i ^= i & -i;
  return an;
}
long long gt(int l, int r) { return gt(r) - gt(l - 1); }
int bs(long long v) {
  int j = 0;
  for (int i = 17; i >= 0; --i) {
    int nj = j + (1 << i);
    if (nj > n) continue;
    if (fn[nj] <= v) {
      j = nj;
      v -= fn[nj];
    }
  }
  return j;
}
void adw(int i, int x) {
  while (i <= n) {
    if (x < 0)
      sb(aw[i], -x);
    else
      ad(aw[i], x);
    i += i & -i;
  }
}
int gtw(int i) {
  int an = 0;
  while (i) ad(an, aw[i]), i ^= i & -i;
  return an;
}
int gtw(int l, int r) {
  int an = gtw(r);
  sb(an, gtw(l - 1));
  return an;
}
void an(int l, int r, int m) {
  int ds = a[m];
  int o = 0;
  sb(o, gtw(l, m));
  ad(o, gt(l, m) % md * ds % md);
  ad(o, gtw(m + 1, r));
  sb(o, gt(m + 1, r) % md * ds % md);
  printf("%d\n", o);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i < (int)(n + 1); ++i) scanf("%d", a + i);
  for (int i = 1; i < (int)(n + 1); ++i) a[i] -= i;
  for (int i = 1; i < (int)(n + 1); ++i) {
    int t;
    scanf("%d", &t);
    adw(i, (long long)a[i] * t % md);
    adf(i, t);
  }
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      l = -l;
      int t = (long long)a[l] * r % md;
      sb(t, gtw(l, l));
      adw(l, t);
      adf(l, r - gt(l, l));
    } else {
      if (l == r) {
        printf("0\n");
        continue;
      }
      long long sg = gt(l, r) >> 1;
      int i = bs(sg + gt(l - 1));
      long long a = gt(l, i), b = gt(i + 1, r);
      if (a > b)
        an(l, r, i);
      else
        an(l, r, i + 1);
    }
  }
}
