#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
int a[maxn], w[maxn], sm[maxn << 2], wsm[maxn << 2], sm2[maxn << 2], n;
long long t[maxn << 2];
void pushup(int rt) {
  t[rt] = t[rt << 1] + t[rt << 1 | 1];
  sm[rt] = (sm[rt << 1] + sm[rt << 1 | 1]) % mod;
  sm2[rt] = (sm2[rt << 1] + sm2[rt << 1 | 1]) % mod;
}
void build(int rt, int l, int r) {
  if (l == r) {
    t[rt] = w[l];
    sm[rt] = 1ll * w[l] * (a[n] - a[l] - (n - l)) % mod;
    sm2[rt] = 1ll * w[l] * (a[l] - a[1] - (l - 1)) % mod;
    return;
  }
  int mid = l + r >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
void cg(int rt, int l, int r, int x, int v) {
  if (l == r) {
    t[rt] = v;
    sm[rt] = 1ll * v * (a[n] - a[l] - (n - l)) % mod;
    sm2[rt] = 1ll * v * (a[l] - a[1] - (l - 1)) % mod;
    return;
  }
  int mid = l + r >> 1;
  if (x <= mid)
    cg(rt << 1, l, mid, x, v);
  else
    cg(rt << 1 | 1, mid + 1, r, x, v);
  pushup(rt);
}
long long qry(int rt, int l, int r, int ql, int qr) {
  if (l >= ql && r <= qr) return t[rt];
  int mid = l + r >> 1;
  long long ans = 0;
  if (ql <= mid) ans += qry(rt << 1, l, mid, ql, qr);
  if (qr >= mid + 1) ans += qry(rt << 1 | 1, mid + 1, r, ql, qr);
  return ans;
}
int qrysm(int rt, int l, int r, int ql, int qr) {
  if (l >= ql && r <= qr) return sm[rt];
  int mid = l + r >> 1;
  int ans = 0;
  if (ql <= mid) ans = (ans + qrysm(rt << 1, l, mid, ql, qr)) % mod;
  if (qr >= mid + 1) ans = (ans + qrysm(rt << 1 | 1, mid + 1, r, ql, qr)) % mod;
  return ans;
}
int qrysm2(int rt, int l, int r, int ql, int qr) {
  if (l >= ql && r <= qr) return sm2[rt];
  int mid = l + r >> 1;
  int ans = 0;
  if (ql <= mid) ans = (ans + qrysm2(rt << 1, l, mid, ql, qr)) % mod;
  if (qr >= mid + 1)
    ans = (ans + qrysm2(rt << 1 | 1, mid + 1, r, ql, qr)) % mod;
  return ans;
}
int fd(int rt, int l, int r, int ql, int qr, long long &val) {
  int mid = l + r >> 1;
  if (l >= ql && r <= qr) {
    if (t[rt] == val) {
      val -= t[rt];
      return r;
    } else if (t[rt] < val) {
      val -= t[rt];
      return r + 1;
    } else if (t[rt] > val) {
      if (l == r) {
        val -= t[rt];
        return l;
      }
      int ans = fd(rt << 1, l, mid, ql, qr, val);
      if (val <= 0) return ans;
      ans = fd(rt << 1 | 1, mid + 1, r, ql, qr, val);
      return ans;
    }
  } else {
    int ans = 0;
    if (ql <= mid) {
      ans = fd(rt << 1, l, mid, ql, qr, val);
      if (val <= 0) return ans;
    }
    if (qr >= mid + 1) {
      ans = fd(rt << 1 | 1, mid + 1, r, ql, qr, val);
      if (val <= 0) return ans;
    }
  }
  return r + 1;
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= n; ++i) {
    sm[i] = (sm[i - 1] + 1ll * w[i] * (a[n] - a[i] - (n - i)) % mod) % mod;
    wsm[i] = (wsm[i - 1] + w[i]) % mod;
  }
  for (int i = n; i >= 1; --i) {
    sm2[i] = (sm2[i + 1] + 1ll * w[i] * (a[i] - a[1] - (i - 1)) % mod) % mod;
  }
  build(1, 1, n);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      cg(1, 1, n, x, y);
    } else {
      long long sum = qry(1, 1, n, x, y);
      sum = (sum + 1) / 2;
      int id = fd(1, 1, n, x, y, sum);
      int ans = qrysm(1, 1, n, x, id);
      ans =
          (ans - 1ll * qry(1, 1, n, x, id) * (a[n] - a[id] - (n - id)) % mod) %
          mod;
      ans = (ans + qrysm2(1, 1, n, id, y)) % mod;
      ans =
          (ans - 1ll * qry(1, 1, n, id, y) * (a[id] - a[1] - (id - 1)) % mod) %
          mod;
      ans = (ans + mod) % mod;
      printf("%d\n", ans);
    }
  }
}
