#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
int n, q;
long long a[maxn], w[maxn];
long long sum[2][maxn];
void update(int rt, int x, long long val) {
  while (x <= n) {
    sum[rt][x] += val;
    if (rt) sum[rt][x] %= mod;
    x += x & (-x);
  }
}
long long query(int rt, int x) {
  long long ret = 0;
  while (x) {
    ret += sum[rt][x];
    if (rt) ret %= mod;
    x -= x & (-x);
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), a[i] -= i - 1;
  for (int i = 1; i <= n; i++) scanf("%lld", &w[i]);
  for (int i = 1; i <= n; i++)
    update(0, i, w[i]), update(1, i, w[i] * a[i] % mod);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      update(0, x, -w[x]);
      update(1, x, mod - w[x] * a[x] % mod);
      w[x] = y;
      update(0, x, w[x]);
      update(1, x, w[x] * a[x] % mod);
    } else {
      int l = x, r = y, t = y;
      long long sum = query(0, y) - query(0, x - 1);
      while (l <= r) {
        int mid = (l + r) >> 1;
        if ((query(0, mid) - query(0, x - 1)) * 2 >= sum)
          r = mid - 1, t = mid;
        else
          l = mid + 1;
      }
      long long ans = (a[t] * ((query(0, t) - query(0, x - 1)) % mod) % mod -
                       (query(1, t) - query(1, x - 1) + mod) % mod + mod) %
                      mod;
      ans = (ans + (query(1, y) - query(1, t) + mod) % mod -
             a[t] * ((query(0, y) - query(0, t)) % mod) % mod + mod) %
            mod;
      printf("%lld\n", ans);
    }
  }
  return 0;
}
