#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
const long long mod = 1000000007;
class BIT {
 public:
  vector<long long> bit;
  int size_ = 0;
  void init(int sz) {
    size_ = sz + 2;
    bit.resize(size_ + 2, 0);
  }
  void add(int pos, int x) {
    pos++;
    while (pos <= size_) {
      bit[pos] += x;
      bit[pos] %= mod;
      pos += (pos & -pos);
    }
  }
  long long sum(int pos) {
    long long x = 0;
    pos++;
    while (pos >= 1) {
      x += bit[pos];
      x %= mod;
      pos -= (pos & -pos);
    }
    return (x + mod * mod) % mod;
  }
};
long long N, Q, A[1 << 18], W[1 << 18];
BIT Z1, Z2;
int main() {
  scanf("%lld%lld", &N, &Q);
  Z1.init(N + 2);
  Z2.init(N + 2);
  for (int i = 1; i <= N; i++) {
    scanf("%lld", &A[i]);
    A[i] -= i;
  }
  for (int i = 1; i <= N; i++) scanf("%lld", &W[i]);
  for (int i = 1; i <= N; i++) {
    Z1.add(i, W[i]);
    Z2.add(i, A[i] * W[i]);
  }
  for (int i = 1; i <= Q; i++) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    if (a < 0) {
      a *= -1;
      Z1.add(a, 1LL * b - W[a]);
      Z2.add(a, 1LL * A[a] * (b - W[a]));
      W[a] = b;
    } else {
      int l = a, r = b;
      int mid = (l + r) / 2;
      long long V1 = 1LL * A[mid] * (Z1.sum(mid) - Z1.sum(l - 1)) -
                     (Z2.sum(mid) - Z2.sum(l - 1));
      V1 += mod * mod;
      V1 %= mod;
      long long V2 =
          (Z2.sum(r) - Z2.sum(mid)) - 1LL * A[mid] * (Z1.sum(r) - Z1.sum(mid));
      V2 += mod * mod;
      V2 %= mod;
      printf("%lld\n", (V1 + V2) % mod);
    }
  }
  return 0;
}
