#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &item) {
  out << '(' << item.first << ", " << item.second << ')';
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (const auto &item : v) out << item << ' ';
  return out;
}
int n;
int a[200010], w[200010];
ll bit1[200010], bit2[200010];
void update(ll bit[], int p, int val, bool modulo = false) {
  for (; p <= n; p += p & (-p)) {
    bit[p] += val;
    if (modulo && bit[p] >= 1000000007) bit[p] -= 1000000007;
  }
}
ll query(ll bit[], int p, bool modulo = false) {
  ll res;
  for (res = 0; p; p &= p - 1) {
    res += bit[p];
    if (modulo && res >= 1000000007) res -= 1000000007;
  }
  return res;
}
ll query(ll bit[], int l, int r, bool modulo = false) {
  if (l > r) return 0;
  ll ans = query(bit, r, modulo) - query(bit, l - 1, modulo);
  if (modulo && ans < 0) ans += 1000000007;
  return ans;
}
int get(int x, int y) {
  int l, r, mid;
  ll sum = query(bit1, x, y);
  for (l = x, r = y; l < r;) {
    mid = (l + r) / 2;
    if (2 * query(bit1, l, mid) >= sum)
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int main() {
  ios_base::sync_with_stdio(false);
  int i, q, x, y, k, ans;
  cin >> n >> q;
  for (i = 1; i <= n; ++i) cin >> a[i];
  for (i = 1; i <= n; ++i) {
    cin >> w[i];
    update(bit1, i, w[i]);
    update(bit2, i, (1LL * w[i] * (a[i] - i)) % 1000000007, true);
  }
  while (q--) {
    cin >> x >> y;
    if (x < 0) {
      i = -x;
      update(bit1, i, 1000000007 - w[i]);
      update(bit2, i,
             (1000000007 - (1LL * w[i] * (a[i] - i)) % 1000000007) % 1000000007,
             true);
      w[i] = y;
      update(bit1, i, w[i]);
      update(bit2, i, (1LL * w[i] * (a[i] - i)) % 1000000007, true);
    } else {
      k = get(x, y);
      ans = 1LL * (a[k] - k) * query(bit1, x, k - 1, true) % 1000000007;
      ans -= query(bit2, x, k - 1, true);
      if (ans < 0) ans += 1000000007;
      ans += query(bit2, k + 1, y, true);
      if (ans >= 1000000007) ans -= 1000000007;
      ans -= 1LL * (a[k] - k) * query(bit1, k + 1, y, true) % 1000000007;
      if (ans < 0) ans += 1000000007;
      cout << ans << '\n';
    }
  }
  return 0;
}
