#include <bits/stdc++.h>
int t1, t2, t3, t4;
int n, q;
int q1, q2;
long long pos[262144];
int w[262144];
int seg1[524288];
int seg2[524288];
long long segw[524288];
long long segc1[524288];
long long segc2[524288];
long long getsegw(int u) {
  if (u < 0) return 0;
  long long out = 0;
  u += 262144;
  while (u & (u + 1)) {
    if (u & 1)
      u /= 2;
    else {
      out += segw[u];
      u = u / 2 - 1;
    }
  }
  return out;
}
int best;
long long ans;
void segmove1(int u) {
  if (seg2[u] < q1 || best < seg1[u]) return;
  if (q1 <= seg1[u] && seg2[u] <= best) {
    ans += segc2[u];
    ans += segw[u] * (pos[best] - pos[seg2[u]]);
    return;
  }
  segmove1(u * 2);
  segmove1(u * 2 + 1);
}
void segmove2(int u) {
  if (seg2[u] < best || q2 < seg1[u]) return;
  if (best <= seg1[u] && seg2[u] <= q2) {
    ans += segc1[u];
    ans += segw[u] * (pos[seg1[u]] - pos[best]);
    return;
  }
  segmove2(u * 2);
  segmove2(u * 2 + 1);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", pos + i);
    pos[i] -= i;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", w + i);
  }
  for (int i = 0; i < 262144; i++) {
    seg1[i + 262144] = seg2[i + 262144] = i;
  }
  for (int i = 262144 - 1; i > 0; i--) {
    seg1[i] = seg1[i * 2];
    seg2[i] = seg2[i * 2 + 1];
  }
  for (int i = 0; i < n; i++) {
    t1 = i + 262144;
    t2 = w[i];
    do {
      segw[t1] += t2;
      segc1[t1] += t2 * (pos[i] - pos[seg1[t1]]);
      segc2[t1] += t2 * (pos[seg2[t1]] - pos[i]);
    } while (t1 /= 2);
  }
  while (q--) {
    scanf("%d%d", &q1, &q2);
    if (q1 < 0) {
      int i = -q1 - 1;
      t1 = 262144 + i;
      t2 = q2 - w[i];
      w[i] = q2;
      do {
        segw[t1] += t2;
        segc1[t1] += t2 * (pos[i] - pos[seg1[t1]]);
        segc2[t1] += t2 * (pos[seg2[t1]] - pos[i]);
      } while (t1 /= 2);
    } else {
      q1--;
      q2--;
      long long w1 = getsegw(q1 - 1);
      long long w2 = getsegw(q2);
      long long remain = w2 + w1;
      t1 = 1;
      while (t1 < 262144) {
        if (remain > segw[t1 * 2] * 2) {
          remain -= segw[t1 * 2] * 2;
          t1 = t1 * 2 + 1;
        } else
          t1 *= 2;
      }
      best = t1 - 262144;
      ans = 0;
      segmove1(1);
      segmove2(1);
      printf("%I64d\n", ans % 1000000007);
    }
  }
}
