#include <bits/stdc++.h>
using namespace std;
using lli = long long;
using lld = long double;
using ulli = unsigned long long int;
using pll = pair<lli, lli>;
using ttt = pair<lli, pll>;
using vttt = vector<ttt>;
using vll = vector<pll>;
using vl = vector<lli>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using cd = complex<lld>;
const double PI = acos(-1);
lli pref[200010], lcol[200010], rcol[200010];
lli arr[200010], wrr[200010];
void add(lli tre[], int x, lli val, bool fl) {
  for (x += 2; x < 200010; x += (x & -x)) {
    tre[x] += val;
    if (fl) tre[x] %= 1000000007;
  }
}
lli get(lli tre[], int x, bool fl) {
  lli res = 0;
  for (x += 2; x > 0; x -= (x & -x)) res += tre[x];
  if (fl) res %= 1000000007;
  return res;
}
lli get(lli tre[], int l, int r, bool fl) {
  if (!fl)
    return get(tre, r, fl) - get(tre, l - 1, fl);
  else
    return (get(tre, r, fl) - get(tre, l - 1, fl) + 1000000007) % 1000000007;
}
lli fin(lli pos, int l, int r) {
  lli move = (get(lcol, pos + 1, r, 1) + get(rcol, l, pos - 1, 1)) % 1000000007;
  lli del1 =
      ((pos - arr[pos]) * (get(pref, l, pos - 1, 0) % 1000000007)) % 1000000007;
  lli del2 =
      ((arr[pos] - pos) * (get(pref, pos + 1, r, 0) % 1000000007)) % 1000000007;
  move = move - del1 - del2 + 1000000007 + 1000000007;
  return move % 1000000007;
}
int tejas_919(int kkkk) {
  lli n, m, k, q, u, v, temp = 0, ans = 0;
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    cin >> wrr[i];
    add(pref, i, wrr[i], 0);
  }
  {
    for (int i = 0; i < n; i++) {
      temp = (i - arr[i]);
      temp *= wrr[i];
      add(rcol, i, temp, 1);
    }
    for (int i = 0; i < n; i++) {
      temp = (arr[i] - i);
      temp *= wrr[i];
      add(lcol, i, temp, 1);
    }
  }
  for (int i = 1; i < q + 1; i++) {
    cin >> u >> v;
    if (u < 0) {
      u = -u - 1;
      temp = v - wrr[u];
      add(pref, u, temp, 0);
      lli t1 = (temp * (u - arr[u]));
      add(rcol, u, t1, 1);
      t1 = (temp * (arr[u] - u));
      add(lcol, u, t1, 1);
      wrr[u] = v;
    } else {
      if (u == v) {
        cout << 0 << '\n';
        continue;
      } else {
        u--;
        v--;
        lli f = get(pref, u, u, 0);
        lli s = get(pref, u + 1, v, 0);
        if (f >= s) {
          cout << fin(u, u, v) << '\n';
          continue;
        }
        int l = u, r = v;
        f += s;
        f /= 2;
        while (r - l > 1) {
          int mid = (l + r) / 2;
          if (get(pref, u, mid, 0) <= f)
            l = mid;
          else
            r = mid;
        }
        cout << fin(l + 1, u, v) << '\n';
      }
    }
  }
  return 0;
}
signed main() {
  if (!0) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  }
  cout << fixed << setprecision(10);
  int t = 1;
  for (int i = 0; i < t; i++) {
    tejas_919(i + 1);
  }
  {};
  if (0) system("pause");
}
