#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const int S = 450;
const int MOD = 1e9 + 7;
const int INF = 1 << 30;
inline void add(int &a, int b) { a = ((long long)a + b) % MOD; }
inline void mul(int &a, int b) { a = (long long)a * b % MOD; }
struct Block {
  int sum, movel, mover, l, r;
} b[S + 10];
long long sum_prev[MAXN], a[MAXN], w[MAXN];
int n, q, x, y;
int calc(int l, int r) {
  int d = l, u = r;
  while (l < r) {
    int mid = (l + r) >> 1;
    if ((mid < 0 ? 0 : sum_prev[mid]) - (d - 1 < 0 ? 0 : sum_prev[d - 1]) >=
        (u < 0 ? 0 : sum_prev[u]) - (mid < 0 ? 0 : sum_prev[mid]))
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%I64d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%I64d", &w[i]);
  sum_prev[0] = w[0];
  for (int i = 1; i < n; i++) sum_prev[i] = sum_prev[i - 1] + w[i];
  for (int i = 0; i < n; i++) add(b[i / S].sum, w[i]);
  for (int i = 0; i < n; i++) {
    int l = i, r = i, id = i / S;
    while (id == (r + 1) / S && r + 1 < n) ++r;
    for (int j = l; j <= r; j++)
      add(b[id].movel, (long long)(a[j] - a[l] - (j - l)) * w[j] % MOD);
    for (int j = r; j >= l; j--)
      add(b[id].mover, (long long)(a[r] - a[j] - (r - j)) * w[j] % MOD);
    b[id].l = l, b[id].r = r;
    i = r;
  }
  for (int i = 1; i <= q; i++) {
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      --x;
      int id = x / S, l = b[id].l, r = b[id].r;
      add(b[id].sum, (y - w[x] + MOD) % MOD);
      add(b[id].movel, MOD - (long long)(a[x] - a[l] - (x - l)) * w[x] % MOD);
      add(b[id].movel, (long long)(a[x] - a[l] - (x - l)) * y % MOD);
      add(b[id].mover, MOD - (long long)(a[r] - a[x] - (r - x)) * w[x] % MOD);
      add(b[id].mover, (long long)(a[r] - a[x] - (r - x)) * y % MOD);
      w[x] = y;
    } else {
      if (x == y) {
        printf("0\n");
        continue;
      }
      --x, --y;
      int L = x, R = y, M = calc(L, R);
      int idl = L / S, idm = M / S, idr = R / S, res = 0, d = max(L, b[idm].l),
          u = min(R, b[idm].r);
      for (int j = M - 1; j >= d; j--)
        add(res, (long long)(a[M] - a[j] - (M - j)) * w[j] % MOD);
      for (int j = M + 1; j <= u; j++)
        add(res, (long long)(a[j] - a[M] - (j - M)) * w[j] % MOD);
      for (int j = idm - 1; j > idl; j--) {
        int x = b[j].r;
        add(res, ((long long)((a[M] - M) - (a[x] - x)) * b[j].sum % MOD +
                  b[j].mover) %
                     MOD);
      }
      for (int j = idm + 1; j < idr; j++) {
        int x = b[j].l;
        add(res, ((long long)((a[x] - x) - (a[M] - M)) * b[j].sum % MOD +
                  b[j].movel) %
                     MOD);
      }
      if (idl != idm)
        for (int j = b[idl].r; j >= L; j--)
          add(res, (long long)((a[M] - M) - (a[j] - j)) * w[j] % MOD);
      if (idr != idm)
        for (int j = b[idr].l; j <= R; j++)
          add(res, (long long)((a[j] - j) - (a[M] - M)) * w[j] % MOD);
      printf("%d\n", res);
    }
  }
  return 0;
}
