#include <bits/stdc++.h>
using namespace std;
int gi() {
  int x = 0, w = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') w = 0, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return w ? x : -x;
}
const int N = 2e5 + 5;
const int mod = 1000000007;
int n, q;
long long a[N], w[N], c1[N], c2[N];
void mdf1(int k, long long v) {
  while (k <= n) c1[k] += v, k += k & -k;
}
long long qry1(int k) {
  long long res = 0;
  while (k) res += c1[k], k ^= k & -k;
  return res;
}
void mdf2(int k, long long v) {
  while (k <= n) c2[k] = (c2[k] + v) % mod, k += k & -k;
}
long long qry2(int k) {
  long long res = 0;
  while (k) res = (res + c2[k]) % mod, k ^= k & -k;
  return res;
}
long long cal(int l, int r, int p, int op) {
  long long s = (qry1(r) - qry1(l - 1)) % mod,
            ss = (qry2(r) - qry2(l - 1) + mod) % mod;
  if (!op)
    return (ss + s * (p - r + mod)) % mod;
  else
    return (s * (l - p + mod) - ss + mod) % mod;
}
int main() {
  n = gi();
  q = gi();
  for (int i = 1; i <= n; ++i) a[i] = gi();
  for (int i = 1; i <= n; ++i) w[i] = gi();
  for (int i = 1; i <= n; ++i)
    mdf1(i, w[i]), mdf2(i, w[i] * (i - a[i] + mod) % mod);
  while (q--) {
    int x = gi(), y = gi();
    if (x < 0)
      x = -x, mdf1(x, y - w[x]),
      mdf2(x, (y - w[x] + mod) * (x - a[x] + mod) % mod), w[x] = y;
    else {
      int l = x, r = y, res = x;
      long long sum1 = qry1(x - 1), sum2 = qry1(y) - sum1;
      while (l <= r) {
        int mid = l + r >> 1;
        if ((qry1(mid) - sum1) * 2 >= sum2)
          res = mid, r = mid - 1;
        else
          l = mid + 1;
      }
      long long ans = cal(x, res, a[res], 0) + cal(res + 1, y, a[res] + 1, 1);
      ans %= mod;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
