#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10, mod = 1e9 + 7;
int n, m, k, t, a[maxn], w[maxn], lg[maxn];
long long d[2][maxn];
void add(long long d[], int x, int y, bool isMOD) {
  if (isMOD && y >= mod) y -= mod;
  while (x <= n) {
    d[x] += y;
    if (isMOD && d[x] >= mod) d[x] -= mod;
    x += x & (-x);
  }
}
long long get(long long d[], int x, bool isMOD) {
  long long ret = 0;
  while (x) {
    ret += d[x];
    if (isMOD && d[x] >= mod) d[x] -= mod;
    x -= x & (-x);
  }
  return ret;
}
int main() {
  int i, j;
  int q;
  scanf("%d%d", &n, &q);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] -= i;
    lg[i] = 1 + lg[i >> 1];
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    add(d[0], i, w[i], false);
    add(d[1], i, 1LL * a[i] * w[i] % mod, true);
  }
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      l *= -1;
      add(d[0], l, -w[l] + r, false);
      add(d[1], l, 1LL * a[l] * (r - w[l]) % mod + mod, true);
      w[l] = r;
    } else {
      int pos = 0;
      long long now = 0;
      long long sum = (get(d[0], r, false) + get(d[0], l - 1, false)) / 2;
      for (i = lg[r] - 1; i >= 0; i--) {
        if (pos + (1 << i) <= n && now + d[0][pos + (1 << i)] <= sum)
          pos += (1 << i), now += d[0][pos];
      }
      pos = max(l, min(pos + 1, r));
      long long ret = 0;
      ret += (get(d[0], pos, false) - get(d[0], l - 1, false)) % mod * a[pos] %
             mod;
      ret -= get(d[1], pos, true) - get(d[1], l - 1, true);
      ret += get(d[1], r, true) - get(d[1], pos - 1, true);
      ret -= (get(d[0], r, false) - get(d[0], pos - 1, false)) % mod * a[pos] %
             mod;
      ret = (ret % mod + mod) % mod;
      printf("%lld\n", ret);
    }
  }
  return 0;
}
