#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0LL) return b;
  if (b == 0LL) return a;
  return gcd(b, a % b);
}
const int N = 200005;
long long A[N], W[N];
pair<long long, long long> tree[N << 2];
pair<long long, long long> temp[N << 2];
void build(int node, int l, int r) {
  if (l == r) {
    tree[node] = make_pair(W[l], (A[l] * W[l]) % 1000000007LL);
    return;
  }
  int mid = (l + r) >> 1;
  int left = node << 1;
  int right = left + 1;
  build(left, l, mid);
  build(right, mid + 1, r);
  tree[node].first = tree[left].first + tree[right].first;
  tree[node].second = (tree[left].second + tree[right].second) % 1000000007LL;
  return;
}
void update(int node, int l, int r, int idx) {
  if (l == r) {
    tree[node] = make_pair(W[idx], (A[idx] * W[idx]) % 1000000007LL);
    return;
  }
  int mid = (l + r) >> 1;
  int left = node << 1;
  int right = left + 1;
  if (idx <= mid)
    update(left, l, mid, idx);
  else
    update(right, mid + 1, r, idx);
  tree[node].first = tree[left].first + tree[right].first;
  tree[node].second = (tree[left].second + tree[right].second) % 1000000007LL;
  return;
}
pair<long long, long long> query(int node, int l, int r, int a, int b) {
  if (l == a && r == b) {
    temp[node] = tree[node];
    return tree[node];
  }
  int mid = (l + r) >> 1;
  int left = node << 1;
  int right = left + 1;
  if (b <= mid) {
    temp[node] = query(left, l, mid, a, b);
    return temp[node];
  } else if (a > mid) {
    temp[node] = query(right, mid + 1, r, a, b);
    return temp[node];
  }
  pair<long long, long long> L = query(left, l, mid, a, mid);
  pair<long long, long long> R = query(right, mid + 1, r, mid + 1, b);
  pair<long long, long long> ans =
      make_pair(L.first + R.first, (L.second + R.second) % 1000000007LL);
  temp[node] = ans;
  return ans;
}
int query1(int node, int l, int r, int a, int b, long long val) {
  int mid = (l + r) >> 1;
  int left = node << 1;
  int right = left + 1;
  if (l == a && r == b) {
    if (l == r) return l;
    if (2LL * tree[left].first < val)
      return query1(right, mid + 1, r, mid + 1, r,
                    val - 2LL * tree[left].first);
    return query1(left, l, mid, l, mid, val);
  }
  if (b <= mid)
    return query1(left, l, mid, a, b, val);
  else if (a > mid)
    return query1(right, mid + 1, r, a, b, val);
  long long val1 = temp[left].first;
  if (2LL * val1 < val)
    return query1(right, mid + 1, r, mid + 1, b, val - 2LL * val1);
  return query1(left, l, mid, a, mid, val);
}
long long getAns(int n, int L, int R, int ind) {
  long long X = A[ind];
  long long ans = 0LL;
  pair<long long, long long> val = query(1, 1, n, L, ind);
  val.first = val.first % 1000000007LL;
  ans = (ans + ((X * val.first) % 1000000007LL) - val.second +
         2LL * 1000000007LL) %
        1000000007LL;
  val = query(1, 1, n, ind, R);
  val.first = val.first % 1000000007LL;
  ans = (ans + val.second - ((X * val.first) % 1000000007LL) +
         2LL * 1000000007LL) %
        1000000007LL;
  return ans;
}
void solve1(int n, int L, int R) {
  pair<long long, long long> val = query(1, 1, n, L, R);
  int ind = query1(1, 1, n, L, R, val.first);
  cout << getAns(n, L, R, ind) << "\n";
  return;
}
void solve() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    A[i] = A[i] - i;
  }
  for (int i = 1; i <= n; i++) cin >> W[i];
  build(1, 1, n);
  int L, R;
  while (q--) {
    cin >> L >> R;
    if (L < 0) {
      L = -1 * L;
      W[L] = R;
      update(1, 1, n, L);
      continue;
    }
    solve1(n, L, R);
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  clock_t clk = clock();
  int t = 1;
  for (int tests = 1; tests <= t; tests++) {
    solve();
  }
  clk = clock() - clk;
  cerr << "Time Elapsed: " << fixed << setprecision(10)
       << ((long double)clk) / CLOCKS_PER_SEC << "\n";
  return 0;
}
