#include <bits/stdc++.h>
using namespace std;
namespace whatever {
int readu() {
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  int value = ch - '0';
  ch = getchar();
  while (isdigit(ch)) {
    value = value * 10 + ch - '0';
    ch = getchar();
  }
  return value;
}
int reads() {
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  int sign = 1;
  if (ch == '-') {
    sign = -1;
    ch = getchar();
  }
  int value = ch - '0';
  ch = getchar();
  while (isdigit(ch)) {
    value = value * 10 + ch - '0';
    ch = getchar();
  }
  return value * sign;
}
void writeu(int n) {
  if (n < 10)
    putchar(n + '0');
  else {
    writeu(n / 10);
    putchar(n % 10 + '0');
  }
}
const int mod = 1000000007;
int n;
void add(int &a, int b) {
  a += b;
  a %= mod;
}
void add(long long &a, long long b) { a += b; }
int low_bit(int a) { return a & -a; }
template <typename type>
void add(type *bit, int index, long long value) {
  while (index <= n) {
    add(bit[index], value);
    index += (index & -index);
  }
}
template <typename type>
type sum(type *bit, int index) {
  type result = 0;
  while (index != 0) {
    add(result, bit[index]);
    index -= (index & -index);
  }
  return result;
}
pair<int, long long> lower_bound(long long *bit, long long value) {
  int index = (1 << 18);
  for (int i = 17; i >= 0; --i)
    if (index - (1 << i) <= n && bit[index - (1 << i)] < value)
      value -= bit[index - (1 << i)];
    else
      index -= (1 << i);
  return make_pair(index, value);
}
void run() {
  n = readu();
  int q = readu();
  static int a[200000 + 1];
  static int w[200000 + 1];
  static long long bit_weight[200000 + 1];
  static int bit_prod[200000 + 1];
  for (int i = 1; i <= n; ++i) a[i] = readu();
  for (int i = 1; i <= n; ++i) {
    w[i] = readu();
    add(bit_weight, i, w[i]);
    add(bit_prod, i, (long long)(a[i] - i) * w[i] % mod);
  }
  while (--q != -1) {
    int x = reads();
    int y = readu();
    if (x < 0) {
      int index = -x;
      int new_w = y;
      add(bit_weight, index, new_w - w[index]);
      add(bit_prod, index,
          (long long)(a[index] - index) * (new_w - w[index] + mod) % mod);
      w[index] = new_w;
    } else {
      int l = x;
      int r = y;
      long long sum_before_l = sum(bit_weight, l - 1);
      long long sum_until_r = sum(bit_weight, r);
      long long sum_between = sum_until_r - sum_before_l;
      long long sum_half_way = sum_before_l + (sum_between + 1) / 2;
      auto [m, remain] = lower_bound(bit_weight, sum_half_way);
      assert(sum(bit_weight, m - 1) + remain == sum_half_way);
      int coeff = (a[m] - m + mod) % mod;
      long long sum_until_m = sum(bit_weight, m);
      int result =
          (sum_until_m * 2 - sum_before_l - sum_until_r) % mod * coeff % mod;
      sum_before_l = sum(bit_prod, l - 1);
      sum_until_m = sum(bit_prod, m);
      sum_until_r = sum(bit_prod, r);
      result = (result - (sum_until_m - sum_before_l) +
                (sum_until_r - sum_until_m)) %
               mod;
      result %= mod;
      result += mod;
      result %= mod;
      writeu(result);
      putchar('\n');
    }
  }
}
}  // namespace whatever
int main() { whatever::run(); }
