#include <bits/stdc++.h>
using namespace std;
const int N = 200100, mod = 1000000007;
inline void reduce(int& x) { x += x >> 31 & mod; }
long long sum[N];
int sum2[N];
int n, q, a[N], b[N], mx;
long long qry(int x) {
  long long ret = 0;
  for (; x; x -= x & -x) ret += sum[x];
  return ret;
}
int qry2(int x) {
  int ret = 0;
  for (; x; x -= x & -x) reduce(ret += sum2[x] - mod);
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (; (1 << mx) <= n; ++mx)
    ;
  --mx;
  for (int i = 1; i <= n; ++i) cin >> a[i], a[i] -= i;
  for (int i = 1; i <= n; ++i) cin >> b[i];
  for (int i = 1; i <= n; ++i) {
    sum[i] += b[i];
    sum2[i] = (sum2[i] + (long long)a[i] * b[i]) % mod;
    if (i + (i & -i) <= n)
      sum[i + (i & -i)] += sum[i], reduce(sum2[i + (i & -i)] += sum2[i] - mod);
  }
  for (; q-- > 0;) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      int delta = (long long)(y - b[x] - mod) * a[x] % mod;
      for (int j = x; j <= n; j += j & -j)
        sum[j] += y - b[x], reduce(sum2[j] += delta);
      b[x] = y;
    } else {
      long long w = qry(x - 1) + qry(y);
      int now = 0;
      for (int j = mx; ~j; --j)
        if (now + (1 << j) <= n && w >= 2 * sum[now + (1 << j)])
          w -= 2 * sum[now += 1 << j];
      int ans = (qry2(y) + qry2(x - 1) - 2 * qry2(now) - w * a[now + 1]) % mod;
      reduce(ans);
      cout << ans << '\n';
    }
  }
  return 0;
}
