#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 200005;
const int NN = N * 4;
long long sum[NN], sum2[NN];
int a[N], w[N], b[N], leaf[N];
void build(int nd, int l, int r) {
  if (l == r) {
    sum[nd] = w[l];
    sum2[nd] = b[l];
    leaf[l] = nd;
    return;
  }
  int m = (l + r) >> 1;
  int cc = nd << 1;
  build(cc, l, m);
  build(cc ^ 1, m + 1, r);
  sum[nd] = sum[cc] + sum[cc ^ 1];
  sum2[nd] = sum2[cc] + sum2[cc ^ 1];
  if (sum2[nd] >= mod) sum2[nd] -= mod;
}
void tinh(int i) {
  int t = (a[i] - i + mod) % mod;
  b[i] = long long(t) * w[i] % mod;
}
void upd(int id) {
  int u = leaf[id];
  sum[u] = w[id];
  tinh(id);
  sum2[u] = b[id];
  u >>= 1;
  while (u > 0) {
    int cc = u << 1;
    sum[u] = sum[cc] + sum[cc ^ 1];
    sum2[u] = sum2[cc] + sum2[cc ^ 1];
    if (sum2[u] >= mod) sum2[u] -= mod;
    u >>= 1;
  }
}
long long query_sum(int nd, int l, int r, int tr, int ph) {
  if (tr > r || ph < l) return 0;
  if (tr <= l && r <= ph) return sum[nd];
  int m = (l + r) >> 1;
  int cc = nd << 1;
  return query_sum(cc, l, m, tr, ph) + query_sum(cc ^ 1, m + 1, r, tr, ph);
}
long long query_sum2(int nd, int l, int r, int tr, int ph) {
  if (tr > r || ph < l) return 0;
  if (tr <= l && r <= ph) return sum2[nd];
  int m = (l + r) >> 1;
  int cc = nd << 1;
  long long t =
      query_sum2(cc, l, m, tr, ph) + query_sum2(cc ^ 1, m + 1, r, tr, ph);
  if (t >= mod) t -= mod;
  return t;
}
int query(int nd, int l, int r, int tr, int ph, long long val, long long &cur) {
  if (tr <= l && r <= ph) {
    if (cur + sum[nd] <= val) {
      cur += sum[nd];
      return r;
    }
    if (l == r) return -1;
  }
  int m = (l + r) >> 1;
  int cc = nd << 1;
  if (m < tr) return query(cc ^ 1, m + 1, r, tr, ph, val, cur);
  if (m + 1 > ph) return query(cc, l, m, tr, ph, val, cur);
  int i1 = query(cc, l, m, tr, ph, val, cur);
  int i2 = -1;
  if (i1 == m) {
    i2 = query(cc ^ 1, m + 1, r, tr, ph, val, cur);
  }
  if (i2 >= 0) return i2;
  return i1;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", w + i);
    tinh(i);
  }
  build(1, 1, n);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      w[-x] = y;
      upd(-x);
    } else {
      if (x == y) {
        puts("0");
        continue;
      }
      long long su = query_sum(1, 1, n, x, y);
      long long cur = 0;
      int id = query(1, 1, n, x, y, su / 2, cur);
      if (id < 0)
        id = x;
      else {
        long long tmp = query_sum(1, 1, n, x, id);
        if (tmp < su - tmp && id < y) ++id;
      }
      long long res = 0;
      long long z = (a[id] - id + mod) % mod;
      if (x < id) {
        long long sum_w = query_sum(1, 1, n, x, id - 1);
        long long sum_2 = query_sum2(1, 1, n, x, id - 1);
        res += sum_w * z % mod;
        if (res >= mod) res -= mod;
        res -= sum_2;
        if (res < 0) res += mod;
      }
      if (id < y) {
        long long sum_w = query_sum(1, 1, n, id + 1, y);
        long long sum_2 = query_sum2(1, 1, n, id + 1, y);
        res -= sum_w * z % mod;
        if (res < 0) res += mod;
        res += sum_2;
        if (res >= mod) res -= mod;
      }
      printf("%lld\n", res);
    }
  }
}
