#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int a[200010], w[200010];
long long B[200010], Bv[200010];
void update(int u, long long x) {
  while (u < 200010) {
    B[u] += x;
    u += u & (-u);
  }
}
long long calc(int u) {
  long long ss = 0;
  while (u > 0) {
    ss += B[u];
    u -= u & (-u);
  }
  return ss;
}
void update1(int u, long long x) {
  while (u < 200010) {
    Bv[u] += x;
    u += u & (-u);
  }
}
long long calc1(int u) {
  long long ss = 0;
  while (u > 0) {
    ss += Bv[u];
    u -= u & (-u);
  }
  return ss % mod;
}
long long calc(int L, int R) { return (calc(R) - calc(L - 1)); }
long long calc1(int L, int R) {
  return ((calc1(R) - calc1(L - 1)) % mod + mod) % mod;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    update(i, w[i]);
    update1(i, 1LL * w[i] * a[i] % mod);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      int id = -x, nw = y;
      update(id, -w[id]);
      update1(id, -(1LL * w[id] * a[id] % mod));
      w[id] = nw;
      update(id, w[id]);
      update1(id, (1LL * w[id] * a[id] % mod));
    } else {
      int L = x, R = y;
      long long C = calc(L, R);
      int st = L - 1, ed = R;
      while (st + 1 < ed) {
        int mid = (st + ed) >> 1;
        if (calc(L, mid) * 2 > C)
          ed = mid;
        else
          st = mid;
      }
      int k = ed;
      long long ans = 1LL * a[k] * (calc(L, k - 1) % mod) - calc1(L, k - 1);
      ans += calc1(k + 1, R) - 1LL * a[k] * (calc(k + 1, R) % mod);
      cout << (ans % mod + mod) % mod << endl;
    }
  }
}
