#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char c) {
  c = tolower(c);
  if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u')
    return 1;
  return 0;
}
const double eps = 0.000001;
const long double pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const long long MOD = 1e18 + 9;
const long long INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 2e5 + 123;
const int M = mod;
const int pri = 997;
const int Magic = 2101;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int n, q;
long long a[N], w[N];
long long f_w[N];
long long f_aw[N];
void inc_w(int x, int y) {
  for (; x < N; x = (x | (x + 1))) {
    f_w[x] += y;
  }
}
void inc_aw(int x, long long y) {
  if (y < 0) y += mod;
  for (; x < N; x = (x | (x + 1))) {
    f_aw[x] += y;
    if (f_aw[x] >= mod) f_aw[x] -= mod;
  }
}
long long get_w(int x) {
  long long res = 0;
  for (; x >= 0; x = (x & (x + 1)) - 1) {
    res += f_w[x];
  }
  return res;
}
int get_aw(int x) {
  int res = 0;
  for (; x >= 0; x = (x & (x + 1)) - 1) {
    res += f_aw[x];
    if (res >= M) res -= M;
  }
  return res;
}
long long get_w(int l, int r) { return get_w(r) - get_w(l - 1); }
int get_aw(int l, int r) {
  int res = get_aw(r);
  res -= get_aw(l - 1);
  if (res < 0) res += M;
  return res;
}
int main() {
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    a[i] -= i;
    cin >> w[i];
    inc_w(i, w[i]);
    inc_aw(i, a[i] * w[i] % mod);
  }
  for (long long i = 1; i <= q; i++) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      inc_w(x, -w[x]);
      inc_aw(x, -((a[x] * w[x]) % mod));
      w[x] = y;
      inc_w(x, w[x]);
      inc_aw(x, (a[x] * w[x]) % mod);
    } else {
      long long sum = get_w(x, y) / 2;
      int l = x - 1, r = y - 1, p = x;
      while (l <= r) {
        int mid = (l + r) / 2;
        if (get_w(x, mid) <= sum) {
          l = p = mid + 1;
        } else {
          r = mid - 1;
        }
      }
      long long ans = get_aw(p + 1, y) - get_aw(x, p);
      if (ans < 0) ans += mod;
      ans += get_w(x, p) % mod * a[p] % mod;
      ans %= mod;
      ans -= (get_w(p + 1, y) % mod * a[p]) % mod;
      if (ans < 0) ans += mod;
      cout << ans << '\n';
    }
  }
  return 0;
}
