#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize(2)
using namespace std;
const long long mod = 1e9 + 7;
struct segt {
  long long wt, d;
  segt operator+(segt other) const {
    segt ret;
    ret.wt = this->wt + other.wt;
    ret.d = (this->d + other.d) % mod;
    return ret;
  }
};
segt tree[524292];
long long x[524292], w[524292];
int n, q;
void build(int l, int r, int index) {
  if (l > r) return;
  if (l == r) {
    tree[index].wt = w[l];
    tree[index].d = w[l] * (x[l] - l);
    tree[index].d %= mod;
    return;
  }
  build(l, ((l + r) >> 1), (index << 1));
  build(((l + r) >> 1) + 1, r, (index << 1 | 1));
  tree[index] = tree[(index << 1)] + tree[(index << 1 | 1)];
}
void update(int pt, int l, int r, int index, long long val) {
  if (l > r || pt < l || pt > r) return;
  if (l == r) {
    w[pt] = val;
    tree[index].wt = w[pt];
    tree[index].d = w[pt] * (x[pt] - l);
    tree[index].d %= mod;
    return;
  }
  if (pt <= ((l + r) >> 1)) {
    update(pt, l, ((l + r) >> 1), (index << 1), val);
  } else {
    update(pt, ((l + r) >> 1) + 1, r, (index << 1 | 1), val);
  }
  tree[index] = tree[(index << 1)] + tree[(index << 1 | 1)];
}
segt query(int start, int end, int l, int r, int index) {
  if (start > end || l > r || start > r || l > end) return tree[0];
  if (start <= l && r <= end) return tree[index];
  if (end <= ((l + r) >> 1)) {
    return query(start, end, l, ((l + r) >> 1), (index << 1));
  }
  if (start >= ((l + r) >> 1) + 1) {
    return query(start, end, ((l + r) >> 1) + 1, r, (index << 1 | 1));
  }
  return query(start, end, l, ((l + r) >> 1), (index << 1)) +
         query(start, end, ((l + r) >> 1) + 1, r, (index << 1 | 1));
}
int main() {
  int i;
  scanf("%d%d", &n, &q);
  for (i = 1; i <= n; ++i) {
    scanf("%I64d", &x[i]);
  }
  for (i = 1; i <= n; ++i) {
    scanf("%I64d", &w[i]);
  }
  build(1, n, 1);
  while (q-- > 0) {
    long long L, R;
    scanf("%I64d%I64d", &L, &R);
    if (L < 0) {
      update(-L, 1, n, 1, R);
    } else {
      if (L == R) {
        printf("0\n");
        continue;
      }
      int low = L, high = R;
      int pivot = low;
      long long W = query(low, high, 1, n, 1).wt;
      while (low <= high) {
        int mid = (low + high) >> 1;
        auto ret = query(L, mid, 1, n, 1);
        if (ret.wt >= W / 2) {
          pivot = mid;
          high = mid - 1;
        } else {
          low = mid + 1;
        }
      }
      auto ret1 = query(L, pivot, 1, n, 1);
      auto ret2 = query(pivot + 1, R, 1, n, 1);
      long long cost1 =
          (((x[pivot] - pivot) * (ret1.wt % mod)) % mod - ret1.d) % mod;
      long long cost2 = (ret2.d + (ret2.wt % mod) * (pivot - x[pivot])) % mod;
      printf("%I64d\n", ((cost1 + cost2) % mod + mod) % mod);
    }
  }
  return 0;
}
