#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E16;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
void mod_print(long long k) {
  long long P = 1000;
  for (long long y = 1; y <= P; y++) {
    long long x = mod(y * k);
    if (x + P >= (long long)(1E9 + 7)) {
      x -= (long long)(1E9 + 7);
    }
    if (abs(x) <= P) {
      cout << x << "/" << y << "\n";
      return;
    }
  }
  cout << "nun"
       << "\n";
}
template <typename T, typename Func_mv>
struct Segtree {
  long long n, n_org;
  vector<T> dat;
  Func_mv merge_values;
  T te;
  Segtree() {}
  Segtree(long long n_org, Func_mv merge_values, T te)
      : n_org(n_org), merge_values(merge_values), te(te) {
    n = 1;
    while (n < n_org) n <<= 1;
    dat.resize(2 * n - 1, te);
  }
  void build(vector<T> &A) {
    for (long long k = 0; k < long long(A.size()); k++) dat[k + n - 1] = A[k];
    for (long long k = n - 2; k >= 0; k--)
      dat[k] = merge_values(dat[2 * k + 1], dat[2 * k + 2]);
  }
  void update(long long k, T x) {
    k += n - 1;
    dat[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = merge_values(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }
  void add(long long k, T x) {
    k += n - 1;
    dat[k] += x;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = merge_values(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }
  T get(long long a, long long b) { return query(a, b + 1, 0, 0, n); }
  long long binary(long long l, long long r) {
    long long ok = r, ng = l - 1;
    while (abs(ok - ng) > 1) {
      long long mid = (ok + ng) / 2;
      if (get(l, mid) * 2 >= get(l, r))
        ok = mid;
      else
        ng = mid;
    }
    return ok;
  }

 private:
  T query(long long a, long long b, long long k, long long lb, long long rb) {
    if (rb <= a || b <= lb) return te;
    if (a <= lb && rb <= b) return dat[k];
    long long mb = (lb + rb) >> 1;
    T vl = query(a, b, 2 * k + 1, lb, mb);
    T vr = query(a, b, 2 * k + 2, mb, rb);
    return merge_values(vl, vr);
  }
};
long long a[200005];
long long w[200005];
auto make_segtree = [](long long N) {
  using T = long long;
  auto merge_values = [](T &a, T &b) { return mod(a + b); };
  T te = 0;
  return Segtree<T, decltype(merge_values)>(N, merge_values, te);
};
auto make_sum = [](long long N) {
  using T = long long;
  auto merge_values = [](T &a, T &b) { return a + b; };
  T te = 0;
  return Segtree<T, decltype(merge_values)>(N, merge_values, te);
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  for (long long i = 0; i <= n - 1; i++) cin >> a[i];
  for (long long i = n - 1; i >= 0; i--) a[i] -= a[0];
  for (long long i = 0; i <= n - 1; i++) cin >> w[i];
  auto st1 = make_segtree(n);
  vector<long long> init(n);
  for (long long i = 1; i <= n - 1; i++) {
    init[i] = mod(w[i] * mod(a[i] - i));
  }
  st1.build(init);
  auto st2 = make_segtree(n);
  vector<long long> init2(n);
  for (long long i = 0; i <= n - 2; i++) {
    init2[i] = mod(w[i] * mod(a[n - 1] - a[i] - (n - 1 - i)));
  }
  st2.build(init2);
  auto sum = make_sum(n);
  vector<long long> init3(n);
  for (long long i = 0; i <= n - 1; i++) init3[i] = w[i];
  sum.build(init3);
  while (q--) {
    long long id, nw;
    cin >> id >> nw;
    if (id < 0) {
      id *= -1;
      id--;
      w[id] = nw;
      sum.update(id, w[id]);
      st1.update(id, mod(w[id] * mod(a[id] - id)));
      st2.update(id, mod(w[id] * (mod(a[n - 1] - a[id]) - mod(n - 1 - id))));
    } else {
      long long l = id - 1, r = nw - 1;
      long long pos = sum.binary(l, r);
      long long a1 = st1.get(pos, r) - mod(sum.get(pos, r) * mod(a[pos] - pos));
      long long a2 =
          st2.get(l, pos) -
          mod(sum.get(l, pos) * mod(a[n - 1] - a[pos] - (n - 1 - pos)));
      cout << mod(a1 + a2) << "\n";
    }
  }
  return 0;
}
