#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long p[maxn], w[maxn];
long long c[maxn];
inline int lowbit(int s) { return s & (-s); }
inline void modify(int i, long long x, int n) {
  while (i <= n) c[i] += x, i += lowbit(i);
}
inline long long query(int i) {
  long long ret = 0;
  while (i > 0) ret += c[i], i -= lowbit(i);
  return ret;
}
long long C[2][maxn];
const long long mod = 1e9 + 7;
inline void Modify(int op, int i, long long x, int n) {
  x = (x % mod + mod) % mod;
  while (i <= n) C[op][i] = (C[op][i] + x) % mod, i += lowbit(i);
}
inline long long Query(int op, int i) {
  long long ret = 0;
  while (i > 0) ret = (ret + C[op][i]) % mod, i -= lowbit(i);
  return ret;
}
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%lld", p + i);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", w + i);
    modify(i, w[i], n);
    Modify(0, i, p[i] * w[i], n);
    Modify(1, i, i * w[i], n);
  }
  while (q--) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    if (x < 0) {
      x = -x;
      modify(x, -w[x], n);
      Modify(0, x, -p[x] * w[x], n);
      Modify(1, x, -x * w[x], n);
      w[x] = y;
      modify(x, w[x], n);
      Modify(0, x, p[x] * w[x], n);
      Modify(1, x, x * w[x], n);
    } else {
      long long tmp = query(x - 1);
      long long tot = query(y) - tmp;
      int l = x, r = y;
      while (l < r) {
        int mid = (l + r) / 2;
        long long now = query(mid) - tmp;
        if (now + now >= tot)
          r = mid;
        else
          l = mid + 1;
      }
      long long st = p[r] - (r - x);
      long long suml1 = (Query(1, r) + mod - Query(1, x - 1)) % mod;
      suml1 = (suml1 +
               (st - x + mod) % mod * ((query(r) + mod - tmp % mod) % mod)) %
              mod;
      long long suml2 = (Query(0, x - 1) + mod - Query(0, r)) % mod;
      st = p[r] + 1;
      long long sumr1 = (Query(0, y) + mod - Query(0, r)) % mod;
      long long sumr2 = (Query(1, y) + mod - Query(1, r)) % mod;
      sumr2 = (sumr2 + (st - (r + 1) + mod) % mod *
                           ((query(y) + mod - query(r) % mod) % mod)) %
              mod;
      sumr2 = (mod - sumr2) % mod;
      long long ans = (suml1 + suml2 + sumr1 + sumr2) % mod;
      printf("%lld\n", ans);
    }
  }
  return 0;
}
