#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
long long mod = 1e9 + 7;
int n, q;
long long a[maxn], w[maxn], x, y;
struct semergetree {
  long long sum[maxn * 4], v[maxn];
  inline void push_up(int rt) { sum[rt] = sum[rt << 1] + sum[rt << 1 | 1]; }
  inline void build(int rt, int l, int r) {
    if (l == r) {
      sum[rt] = v[l];
      return;
    }
    int mid = (l + r) >> 1;
    build(rt << 1, l, mid);
    build(rt << 1 | 1, mid + 1, r);
    push_up(rt);
  }
  void update(int rt, int l, int r, int pos, long long val) {
    if (l == r) {
      sum[rt] = val;
      return;
    }
    int mid = (l + r) >> 1;
    if (pos <= mid)
      update(rt << 1, l, mid, pos, val);
    else
      update(rt << 1 | 1, mid + 1, r, pos, val);
    push_up(rt);
  }
  long long query(int rt, int l, int r, int L, int R) {
    if (L <= l && r <= R) {
      return sum[rt];
    }
    int mid = (l + r) >> 1;
    if (R <= mid)
      return query(rt << 1, l, mid, L, R);
    else if (L > mid)
      return query(rt << 1 | 1, mid + 1, r, L, R);
    else
      return query(rt << 1, l, mid, L, mid) +
             query(rt << 1 | 1, mid + 1, r, mid + 1, R);
  }
  int find_k(int rt, int l, int r, int L, int R, long long val) {
    if (l == r) {
      return l;
    }
    int mid = (l + r) >> 1;
    if (R <= mid) return find_k(rt << 1, l, mid, L, R, val);
    if (L > mid) return find_k(rt << 1 | 1, mid + 1, r, L, R, val);
    long long res = query(rt << 1, l, mid, L, mid);
    if (res >= val)
      return find_k(rt << 1, l, mid, L, mid, val);
    else
      return find_k(rt << 1 | 1, mid + 1, r, mid + 1, R, val - res);
  }
} T1, T2;
int main() {
  scanf("%d%d", &n, &q);
  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++) T1.v[i] = w[i], T2.v[i] = (a[i] * w[i]) % mod;
  T1.build(1, 1, n);
  T2.build(1, 1, n);
  for (int i = 1; i <= q; i++) {
    scanf("%lld%lld", &x, &y);
    if (x < 0) {
      x = -x;
      w[x] = y;
      T1.update(1, 1, n, x, w[x]);
      T2.update(1, 1, n, x, (a[x] * w[x]));
    } else {
      long long sum = T1.query(1, 1, n, x, y);
      int pos = T1.find_k(1, 1, n, x, y, (sum + 1) >> 1);
      long long ans = 0;
      ans += (a[pos] * (T1.query(1, 1, n, x, pos) - T1.query(1, 1, n, pos, y)));
      ans -= (T2.query(1, 1, n, x, pos) - T2.query(1, 1, n, pos, y)) % mod;
      ans %= mod;
      while (ans < 0) ans += mod;
      cout << ans << endl;
    }
  }
  return 0;
}
