#include <bits/stdc++.h>
using namespace std;
namespace Input {
const int BUF = 65536;
char buf[BUF + 1];
char *head = buf, *tail = buf;
inline char inputchar() {
  if (head == tail) *(tail = (head = buf) + fread(buf, 1, BUF, stdin)) = 0;
  return *head++;
}
inline void inputnum(int &ret) {
  char ch = inputchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = inputchar();
  int sgn = (ch == '-' ? ch = inputchar(), -1 : 1);
  for (ret = 0; ch >= '0' && ch <= '9'; ch = inputchar())
    ret = ret * 10 + ch - '0';
  ret *= sgn;
}
}  // namespace Input
using Input::inputnum;
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 += b;
  if (a >= MOD) a -= 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];
int a[MAXN], w[MAXN];
int n, q, x, y;
long long bit[MAXN];
inline int lowbit(int x) { return x & -x; }
inline void bit_add(int x, long long v) {
  ++x;
  for (int i = x; i <= n; i += lowbit(i)) bit[i] += v;
}
inline long long SUM(int x) {
  ++x;
  if (x <= 0) return 0;
  long long ret = 0;
  for (int i = x; i > 0; i ^= lowbit(i)) ret += bit[i];
  return ret;
}
int calc(int l, int r) {
  long long sum_d = SUM(l - 1), sum_u = SUM(r);
  while (l < r) {
    int mid = (l + r) >> 1;
    if (SUM(mid) - sum_d >= sum_u - SUM(mid))
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int main() {
  inputnum(n), inputnum(q);
  for (int i = 0; i < n; i++) inputnum(a[i]);
  for (int i = 0; i < n; i++) inputnum(w[i]);
  for (int i = 0; i < n; i++) bit_add(i, 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++) {
    inputnum(x), inputnum(y);
    if (x < 0) {
      x = -x;
      --x;
      int id = x / S, l = b[id].l, r = b[id].r;
      bit_add(x, y - w[x]);
      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;
}
