#include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 5;
const int MOD = 1E9 + 7;
int n, m, a[N], w[N], x, y, l, r, mid, p[N], pre[N], ne[N];
long long f[N], tr[2][N], ans, s0, s1, s2, s3;
void add(int k, int x, long long w) {
  for (; x <= n; x += x & -x) {
    tr[k][x] += w;
    if (!k) tr[k][x] %= MOD;
  }
}
long long get(int k, int x) {
  long long sum = 0;
  for (; x; x -= x & -x) {
    sum += tr[k][x];
    if (!k) sum %= MOD;
  }
  return sum;
}
void work(int x, long long k) {
  add(0, x, k * w[x] * a[x]);
  add(1, x, k * w[x]);
  f[p[x]] += k * w[x];
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] -= i;
    p[i] = p[i - 1];
    if (i == 1 || a[i] != a[i - 1]) p[i] = p[i - 1] + 1;
    if (p[i] == p[i - 1])
      pre[i] = pre[i - 1];
    else
      pre[i] = i - 1;
  }
  for (int i = n; i; i--)
    if (p[i] == p[i + 1])
      ne[i] = ne[i + 1];
    else
      ne[i] = i + 1;
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]), work(i, 1);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      work(x, -1);
      w[x] = y;
      work(x, 1);
    } else {
      l = x;
      r = y;
      s0 = get(1, x - 1);
      s1 = get(1, y);
      while (l <= r) {
        mid = (l + r) / 2;
        if (pre[mid] >= x)
          s2 = get(1, pre[mid]) - s0;
        else
          s2 = 0;
        if (ne[mid] <= y)
          s3 = s1 - get(1, ne[mid] - 1);
        else
          s3 = 0;
        if (abs(s2 - s3) <= f[p[mid]]) break;
        if (s2 < s3)
          l = mid + 1;
        else
          r = mid - 1;
      }
      ans = get(0, y) - get(0, mid) * 2 + get(0, x - 1) -
            (get(1, y) - get(1, mid) * 2 + get(1, x - 1)) % MOD * a[mid] % MOD;
      ans = (ans % MOD + MOD) % MOD;
      printf("%lld\n", ans);
    }
  }
}
