#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 2e5 + 5;
int pos[MAX], w[MAX], wa_bit[MAX];
long long w_bit[MAX];
int n, q;
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (0 > a) {
    a += MOD;
  }
  return a;
}
inline int mult(int a, int b) { return (1LL * a * b) % MOD; }
void update(int idx, int val, int bit[]) {
  while (idx < MAX) {
    bit[idx] = add(bit[idx], val);
    idx += idx & -idx;
  }
}
int query(int idx, int bit[]) {
  int total = 0;
  while (idx) {
    total = add(total, bit[idx]);
    idx -= idx & -idx;
  }
  return total;
}
int query(int left, int right, int bit[]) {
  if (left > right) {
    return 0;
  }
  return sub(query(right, bit), query(left - 1, bit));
}
void ll_update(int idx, long long val, long long bit[]) {
  while (idx < MAX) {
    bit[idx] += val;
    idx += idx & -idx;
  }
}
long long ll_query(int idx, long long bit[]) {
  long long total = 0;
  while (idx) {
    total += bit[idx];
    idx -= idx & -idx;
  }
  return total;
}
long long ll_query(int left, int right, long long bit[]) {
  if (left > right) {
    return 0;
  }
  return ll_query(right, bit) - ll_query(left - 1, bit);
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = int(1); i < int(n + 1); i++) {
    scanf("%d", pos + i);
    pos[i] -= i;
  }
  for (int i = int(1); i < int(n + 1); i++) {
    scanf("%d", w + i);
    ll_update(i, w[i], w_bit);
    update(i, mult(w[i], pos[i]), wa_bit);
  }
  for (int t = int(0); t < int(q); t++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x < 0) {
      int id = -x;
      int nw = y;
      ll_update(id, -w[id], w_bit);
      update(id, (-mult(w[id], pos[id])) + MOD, wa_bit);
      w[id] = nw;
      ll_update(id, w[id], w_bit);
      update(id, mult(w[id], pos[id]), wa_bit);
    } else {
      int l = x;
      int r = y;
      int left = l, right = r;
      int k = -1;
      long long total_sum = ll_query(l, r, w_bit);
      while (left <= right) {
        int mid = (left + right) / 2;
        long long cur_sum = ll_query(l, mid, w_bit);
        if (2 * cur_sum >= total_sum) {
          k = mid;
          right = mid - 1;
        } else {
          left = mid + 1;
        }
      }
      int ans = mult(ll_query(l, k - 1, w_bit) % MOD, pos[k]);
      ans = sub(ans, query(l, k - 1, wa_bit));
      ans = add(ans, query(k + 1, r, wa_bit));
      ans = sub(ans, mult(ll_query(k + 1, r, w_bit) % MOD, pos[k]));
      printf("%d\n", ans);
    }
  }
  return 0;
}
