#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline int gi() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - 48;
    ch = getchar();
  }
  return x * f;
}
template <typename T>
inline bool Max(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool Min(T &a, T b) {
  return b < a ? a = b, 1 : 0;
}
const int N = 2e5 + 7, mod = 1e9 + 7;
int n, q;
LL w[N], p[N];
void add(LL &a, LL b) {
  a += b;
  if (a >= mod) a -= mod;
}
LL s[N << 2];
void modify(int p, int l, int r, int o, LL v) {
  s[o] += v;
  if (l == r) return;
  int mid = l + r >> 1;
  if (p <= mid)
    modify(p, l, mid, o << 1, v);
  else
    modify(p, mid + 1, r, o << 1 | 1, v);
}
int query(int l, int r, int o, LL sum) {
  if (l == r) return l;
  int mid = l + r >> 1;
  if (s[o << 1] >= sum) return query(l, mid, o << 1, sum);
  return query(mid + 1, r, o << 1 | 1, sum - s[o << 1]);
}
LL querys(int L, int R, int l, int r, int o) {
  if (L > R) return 0;
  if (L <= l && r <= R) return s[o];
  int mid = l + r >> 1;
  if (R <= mid) return querys(L, R, l, mid, o << 1);
  if (L > mid) return querys(L, R, mid + 1, r, o << 1 | 1);
  return querys(L, R, l, mid, o << 1) + querys(L, R, mid + 1, r, o << 1 | 1);
}
struct BIT {
  LL tr[N];
  int lowbit(int x) { return x & -x; }
  void modify(int x, LL y) {
    for (int i = x; i <= n; i += lowbit(i)) add(tr[i], y);
  }
  LL query(int x) {
    LL res = 0ll;
    for (int i = x; i; i -= lowbit(i)) add(res, tr[i]);
    return res;
  }
  LL q(int l, int r) { return query(r) - query(l - 1); }
} t[2];
int main() {
  n = gi(), q = gi();
  for (int i = 1; i <= n; ++i) p[i] = gi();
  for (int i = 1; i <= n; ++i) w[i] = gi() % mod;
  for (int i = 1; i <= n; ++i) {
    t[0].modify(i, p[i] * w[i] % mod);
    t[1].modify(i, i * w[i] % mod);
    modify(i, 1, n, 1, w[i]);
  }
  while (q--) {
    int x = gi(), y = gi();
    if (x < 0) {
      x = -x;
      LL tt = y - w[x];
      modify(x, 1, n, 1, tt);
      t[0].modify(x, p[x] * tt % mod);
      t[1].modify(x, x * tt % mod);
      w[x] = y;
    } else {
      LL ans = 0;
      int l = x, r = y;
      int pos =
          query(1, n, 1, querys(1, y, 1, n, 1) - (querys(x, y, 1, n, 1) / 2));
      add(ans, ((-t[0].q(l, pos) +
                 querys(l, pos, 1, n, 1) % mod * (p[pos] - pos) % mod +
                 t[1].q(l, pos)) %
                    mod +
                mod) %
                   mod);
      add(ans, ((t[0].q(pos + 1, r) -
                 querys(pos + 1, r, 1, n, 1) % mod * (p[pos] - pos) % mod -
                 t[1].q(pos + 1, r)) %
                    mod +
                mod) %
                   mod);
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
