#include <bits/stdc++.h>
using namespace std;
long long sum1[300010 << 2], sum2[300010 << 2];
int a[300010], w[300010];
int n, q;
long long mod(long long a) {
  a %= 1000000007;
  if (a < 0) a += 1000000007;
  return a;
}
long long add(long long a, long long b) { return mod(a + b); }
long long mul(long long a, long long b) { return mod(a * b); }
void pushup1(int t) { sum1[t] = sum1[(t << 1)] + sum1[(t << 1 | 1)]; }
void pushup2(int t) { sum2[t] = add(sum2[(t << 1)], sum2[(t << 1 | 1)]); }
void modify1(int t, int l, int r, int pos, long long vl) {
  if (l == r) {
    sum1[t] = vl;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    modify1((t << 1), l, mid, pos, vl);
  else
    modify1((t << 1 | 1), mid + 1, r, pos, vl);
  pushup1(t);
}
void modify2(int t, int l, int r, int pos, long long vl) {
  if (l == r) {
    sum2[t] = vl;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    modify2((t << 1), l, mid, pos, vl);
  else
    modify2((t << 1 | 1), mid + 1, r, pos, vl);
  pushup2(t);
}
long long query1_sum(int t, int l, int r, int L, int R) {
  if (L <= l && r <= R) return sum1[t];
  int mid = (l + r) >> 1;
  if (R <= mid) return query1_sum((t << 1), l, mid, L, R);
  if (L > mid) return query1_sum((t << 1 | 1), mid + 1, r, L, R);
  return query1_sum((t << 1), l, mid, L, mid) +
         query1_sum((t << 1 | 1), mid + 1, r, mid + 1, R);
}
int query1_pos(int t, int l, int r, int L, int R, long long vl) {
  if (l == r) return l;
  int mid = (l + r) >> 1;
  if (R <= mid) return query1_pos((t << 1), l, mid, L, R, vl);
  if (L > mid) return query1_pos((t << 1 | 1), mid + 1, r, L, R, vl);
  long long suml = query1_sum((t << 1), l, mid, L, mid);
  if (suml >= vl)
    return query1_pos((t << 1), l, mid, L, mid, vl);
  else
    return query1_pos((t << 1 | 1), mid + 1, r, mid + 1, R, vl - suml);
}
long long query2_sum(int t, int l, int r, int L, int R) {
  if (L <= l && r <= R) return sum2[t];
  int mid = (l + r) >> 1;
  if (R <= mid) return query2_sum((t << 1), l, mid, L, R);
  if (L > mid) return query2_sum((t << 1 | 1), mid + 1, r, L, R);
  return add(query2_sum((t << 1), l, mid, L, mid),
             query2_sum((t << 1 | 1), mid + 1, r, mid + 1, R));
}
int main() {
  int i;
  int n, q;
  cin >> n >> q;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (i = 1; i <= n; i++) cin >> w[i];
  for (i = 1; i <= n; i++) {
    modify1(1, 1, n, i, w[i]);
    modify2(1, 1, n, i, mul(a[i], w[i]));
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      w[x] = y;
      modify1(1, 1, n, x, w[x]);
      modify2(1, 1, n, x, mul(a[x], w[x]));
    } else {
      long long sum = query1_sum(1, 1, n, x, y);
      int pos = query1_pos(1, 1, n, x, y, (sum + 1) >> 1);
      long long ans = 0;
      ans = add(ans, mul(a[pos], add(query1_sum(1, 1, n, x, pos),
                                     -query1_sum(1, 1, n, pos, y))));
      ans = add(ans,
                add(-query2_sum(1, 1, n, x, pos), query2_sum(1, 1, n, pos, y)));
      printf("%lld\n", ans);
    }
  }
  return 0;
}
