#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
const int mod = 1000000007, MAX = 200005, INF = 1 << 30;
template <typename T>
struct SegmentTree {
  using F = function<T(T, T)>;
  int n;
  vector<T> dat;
  F f;
  T ti;
  SegmentTree(int n_, F f, T ti) : f(f), ti(ti) {
    n = 1;
    while (n < n_) n *= 2;
    dat.assign(2 * n - 1, ti);
  }
  SegmentTree(int n_, vector<T> &v, F f, T ti) : f(f), ti(ti) {
    n = 1;
    while (n < n_) n *= 2;
    dat.assign(2 * n - 1, ti);
    for (int i = n - 1; i - (n - 1) < v.size(); i++) dat[i] = v[i - (n - 1)];
    for (int i = n - 2; i >= 0; i--) dat[i] = f(dat[i * 2 + 1], dat[i * 2 + 2]);
  }
  void update(int k, T x) {
    k += n - 1;
    dat[k] = x;
    while (k) {
      k = (k - 1) / 2;
      dat[k] = f(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  void set(int k, T x) { dat[n - 1 + k] = x; }
  void built() {
    for (int i = n - 2; i >= 0; i--) dat[i] = f(dat[i * 2 + 1], dat[i * 2 + 2]);
  }
  T query_(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return ti;
    if (a <= l && r <= b)
      return dat[k];
    else {
      T vl = query_(a, b, 2 * k + 1, l, (l + r) / 2);
      T vr = query_(a, b, 2 * k + 2, (l + r) / 2, r);
      return f(vl, vr);
    }
  }
  T query(int a, int b) { return query_(a, b, 0, 0, n); }
  T get(int k) { return dat[k + n - 1]; }
  template <typename C>
  int findright(int st, C &check, T &acc, int k, int l, int r) {
    if (l + 1 == r) {
      acc = f(acc, dat[k]);
      return check(acc) ? k - (n - 1) : -1;
    }
    int m = (l + r) / 2;
    if (m <= st) return findright(st, check, acc, 2 * k + 2, m, r);
    if (st <= l && !check(f(acc, dat[k]))) {
      acc = f(acc, dat[k]);
      return -1;
    }
    int vl = findright(st, check, acc, 2 * k + 1, l, m);
    if (~vl) return vl;
    return findright(st, check, acc, 2 * k + 2, m, r);
  }
  template <typename C>
  int findright(int st, C &check) {
    T acc = ti;
    return findright(st, check, acc, 0, 0, n);
  }
  template <typename C>
  int findleft(int st, C &check, T &acc, int k, int l, int r) {
    if (l + 1 == r) {
      acc = f(acc, dat[k]);
      return check(acc) ? k - (n - 1) : INF;
    }
    int m = (l + r) / 2;
    if (m >= st) return findleft(st, check, acc, 2 * k + 1, l, m);
    if (st >= r && !check(f(acc, dat[k]))) {
      acc = f(acc, dat[k]);
      return INF;
    }
    int vr = findleft(st, check, acc, 2 * k + 2, m, r);
    if (vr != INF) return vr;
    return findleft(st, check, acc, 2 * k + 1, l, m);
  }
  template <typename C>
  int findleft(int st, C &check) {
    T acc = ti;
    return findleft(st, check, acc, 0, 0, n);
  }
};
int main() {
  std::ifstream in("text.txt");
  std::cin.rdbuf(in.rdbuf());
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  vector<double> pos(N);
  vector<long long> w(N);
  for (int i = 0; i < N; i++) {
    cin >> pos[i];
    pos[i] -= i;
  }
  for (int i = 0; i < N; i++) {
    cin >> w[i];
  }
  SegmentTree<pair<long long, long long>> seg(
      N,
      [](pair<long long, long long> a, pair<long long, long long> b) {
        return make_pair(a.first + b.first, a.second + b.second);
      },
      make_pair(0, 0));
  SegmentTree<long long> wsum(
      N, w, [](long long a, long long b) { return a + b; }, 0);
  for (int i = 0; i < N; i++) {
    seg.update(i, make_pair(w[i] * pos[i], w[i] * (1000000000LL - pos[i])));
  }
  while (Q--) {
    long long l, r;
    cin >> l >> r;
    if (l < 0) {
      l *= -1;
      l--;
      seg.update(l, make_pair(r * pos[l], r * (1000000000LL - pos[l])));
      wsum.update(l, r);
    } else {
      l--;
      r--;
      double lpos = pos[l], rpos = pos[r];
      for (int k = 0; k < 50; k++) {
        double c1 = (lpos * 2 + rpos) / 3.0, c2 = (lpos + rpos * 2) / 3.0;
        int d1 = lower_bound((pos).begin(), (pos).end(), c1) - pos.begin(),
            d2 = lower_bound((pos).begin(), (pos).end(), c2) - pos.begin();
        double lsum1 = 0, rsum1 = 0, lsum2 = 0, rsum2 = 0;
        lsum1 += double(seg.query(l, d1).second) -
                 double(wsum.query(l, d1)) * (1000000000LL - c1);
        rsum1 += double(seg.query(d1, r + 1).first) -
                 double(wsum.query(d1, r + 1)) * c1;
        lsum2 += double(seg.query(l, d2).second) -
                 double(wsum.query(l, d2)) * (1000000000LL - c2);
        rsum2 += double(seg.query(d2, r + 1).first) -
                 double(wsum.query(d2, r + 1)) * c2;
        if (lsum1 + rsum1 <= lsum2 + rsum2)
          rpos = c2;
        else
          lpos = c1;
      }
      long long ans = 1LL << 62;
      for (long long p = max(pos[0], lpos - 1.0);
           p <= min(pos[N - 1], lpos + 1.0); p++) {
        int d = lower_bound((pos).begin(), (pos).end(), p) - pos.begin();
        long long lsum = 0, rsum = 0;
        lsum += seg.query(l, d).second - wsum.query(l, d) * (1000000000LL - p);
        rsum += seg.query(d, r + 1).first - wsum.query(d, r + 1) * p;
        long long sum = lsum + rsum;
        chmin(ans, sum);
      }
      cout << ans % mod << endl;
    }
  }
}
