#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int MOD = 1000000007;
long long A[N];
int B[N];
int n, q, a[N], w[N];
void add(int a, int b) {
  for (int i = a; i <= n; i += (i & -i)) {
    A[i] += b;
  }
}
long long ask(int a) {
  long long ret = 0;
  for (; a > 0; a -= (a & -a)) {
    ret += A[a];
  }
  return ret;
}
void add2(int a, int b) {
  for (int i = a; i <= n; i += (i & -i)) {
    (B[i] += b) %= MOD;
  }
}
long long ask2(int a) {
  long long ret = 0;
  for (; a > 0; a -= (a & -a)) {
    (ret += B[a]) %= MOD;
  }
  return ret;
}
int find(long long k) {
  int ans = 0, i;
  long long cnt = 0;
  for (i = 20; i >= 0; i--) {
    if (ans + (1 << i) <= n && cnt + A[ans + (1 << i)] < k) {
      ans += (1 << i);
      cnt += A[ans];
    }
  }
  return ans + 1;
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    add(i, w[i]);
    add2(i, (long long)w[i] * (((a[i] - i) + MOD) % MOD) % MOD);
  }
  while (q--) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x < 0) {
      x = -x;
      add(x, y - w[x]);
      add2(x, ((long long)y * (((a[x] - x) + MOD) % MOD) % MOD -
               (long long)w[x] * (((a[x] - x) + MOD) % MOD) % MOD + MOD) %
                  MOD);
      w[x] = y;
    } else {
      long long sr = ask(y);
      long long sl = ask(x - 1);
      long long sum = sr - sl;
      int mid = find(sl + (sum + 1) / 2);
      long long smid = ask(mid);
      long long xx = (a[mid] - mid + MOD) % MOD;
      long long ans = ask2(y) - ask2(mid) - (sr - smid) % MOD * xx % MOD;
      ans +=
          (smid - w[mid] - sl) % MOD * xx % MOD - (ask2(mid - 1) - ask2(x - 1));
      ans %= MOD;
      while (ans < 0) {
        ans += MOD;
      }
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
