#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2 * 1e5 + 1;
const long long INF = 1e9 + 1;
const long long MOD = 1e9 + 7;
const long long BITS = 64;
const long long PRIME = 31;
const long double EPS = 1e-12;
void bye() {
  cout << "\n";
  exit(0);
}
long long FW[MAXN], FAW[MAXN];
long long g[MAXN], w[MAXN];
long long norm(long long a) {
  if (a >= MOD) {
    a %= MOD;
  } else if (a < 0) {
    a += MOD;
  }
  return a;
}
long long mult(long long a, long long b) { return (a * b) % MOD; }
void inc(bool f, long long pos, long long val) {
  if (f) {
    for (; pos < MAXN; pos |= (pos + 1)) {
      FW[pos] += val;
    }
  } else {
    for (; pos < MAXN; pos |= (pos + 1)) {
      FAW[pos] += val;
    }
  }
}
long long sum(bool f, long long pos) {
  long long ans = 0;
  if (f) {
    for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {
      ans += FW[pos];
    }
  } else {
    for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {
      ans += FAW[pos];
    }
  }
  return ans;
}
long long get_sum(bool f, long long l, long long r) {
  return sum(f, r - 1) - sum(f, l - 1);
}
long long getMsum(bool f, long long l, long long r) {
  return norm(sum(f, r - 1) - sum(f, l - 1));
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, q;
  cin >> n >> q;
  for (long long i = 0; i < n; i++) {
    cin >> g[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> w[i];
  }
  for (long long i = 0; i < n; i++) {
    g[i] -= i;
    inc(1, i, w[i]);
    inc(0, i, mult(g[i], w[i]));
  }
  while (q--) {
    long long x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      x--;
      inc(1, x, -w[x]);
      inc(0, x, -mult(g[x], w[x]));
      w[x] = y;
      inc(1, x, w[x]);
      inc(0, x, mult(g[x], w[x]));
    } else {
      x--;
      long long l = x, r = y;
      long long sum = get_sum(1, l, r);
      while (r - l > 1) {
        long long mid = (r + l) / 2;
        if (2 * get_sum(1, x, mid) > sum) {
          r = mid;
        } else {
          l = mid;
        }
      }
      long long ans = norm(mult(g[l], getMsum(1, x, l)) - getMsum(0, x, l));
      ans = norm(ans + norm(getMsum(0, l, y) - mult(g[l], getMsum(1, l, y))));
      cout << ans << "\n";
    }
  }
  bye();
}
