#include <bits/stdc++.h>
using namespace std;
const int MXN = 2e5 + 10, MXM = 5010;
long long MOD = 1e9 + 7;
int N, Q;
long long a[MXN], w[MXN];
template <typename T>
struct fenwick {
  T f[MXN] = {};
  void update(int x, T val) {
    for (; x <= N; x += x & -x) (f[x] = f[x] + val);
  }
  T get(int x) {
    T res = 0;
    for (; x; x -= x & -x) {
      (res = res + f[x]);
    }
    return res;
  }
  T get(int x1, int x2) {
    x1 = max(x1 - 1, 0);
    x2 = min(x2, N);
    return get(x2) - get(x1);
  }
  T findmid(int x1, int x2) {
    long long s1, s2, goal, res = 0;
    int x = 0;
    x1 = max(x1 - 1, 0);
    x2 = min(x2, N);
    s1 = get(x1);
    s2 = get(x2);
    goal = (s1 + s2 + 1) >> 1;
    for (int k = 20; k >= 0; --k) {
      if (x + (1 << k) <= N)
        if (res + f[x + (1 << k)] < goal) {
          res += f[x + (1 << k)];
          x += 1 << k;
        }
    }
    return x + 1;
  }
};
template <typename T>
struct fenwickMOD {
  T f[MXN] = {};
  void update(int x, T val) {
    for (; x <= N; x += x & -x) (f[x] = f[x] + val) %= MOD;
  }
  T get(int x) {
    T res = 0;
    for (; x; x -= x & -x) {
      (res = res + f[x]) %= MOD;
    }
    return res;
  }
  T get(int x1, int x2) {
    x1 = max(x1 - 1, 0);
    x2 = min(x2, N);
    return (get(x2) - get(x1) + MOD) % MOD;
  }
};
fenwick<long long> F;
fenwickMOD<long long> F2;
void upd(int x, int y) {
  int d = y - w[x];
  F.update(x, d);
  F2.update(x, (a[x] - x) * d);
  w[x] = y;
}
void init() {
  cin >> N >> Q;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    upd(i, x);
  }
}
namespace solve {
void solve() {
  for (int t = 0; t < Q; t++) {
    int x, y;
    cin >> x >> y;
    if (x > 0) {
      long long ans = 1e18;
      int m = F.findmid(x, y);
      {
        long long t =
            (F.get(x, m - 1) - F.get(m + 1, y)) % MOD * (a[m] - m) % MOD;
        long long t2 = F2.get(m + 1, y) - F2.get(x, m - 1);
        ans = min(ans, t + t2);
      }
      cout << (ans % MOD + MOD) % MOD << endl;
    } else {
      x = -x;
      upd(x, y);
    }
  }
}
}  // namespace solve
int main() {
  init();
  solve::solve();
  return 0;
}
