#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const double EPS = 1e-9;
const double PI = 3.14159265359;
const long long MOD = 1e9 + 7;
struct node {
  int l, r;
  long long sum, mul;
  int child_left, child_right;
  node(int l1 = -1, int r1 = -1, int val = 0) {
    child_left = child_right = -1;
    l = l1, r = r1, sum = val;
  }
};
vector<node> tree;
vector<int> a, w;
void mod(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
void update(node &root) {
  root.sum = root.mul = 0;
  if (root.child_left != -1) {
    mod(root.sum, tree[root.child_left].sum);
    mod(root.mul, tree[root.child_left].mul);
  }
  if (root.child_right != -1) {
    mod(root.sum, tree[root.child_right].sum);
    mod(root.mul, tree[root.child_right].mul);
  }
}
int build(int L, int R) {
  node root = node(L, R);
  if (L == R) {
    root.sum = w[L];
    root.mul = w[L] * (a[L] - L);
    tree.push_back(root);
    return tree.size() - 1;
  }
  int m = (L + R) / 2;
  root.child_left = build(L, m);
  root.child_right = build(m + 1, R);
  update(root);
  tree.push_back(root);
  return tree.size() - 1;
}
void change(int root, int ind, int nw) {
  if (tree[root].l > ind || tree[root].r < ind) return;
  if (tree[root].l == tree[root].r) {
    tree[root].sum = nw;
    tree[root].mul = nw * (a[ind] - ind);
    return;
  }
  change(tree[root].child_left, ind, nw);
  change(tree[root].child_right, ind, nw);
  update(tree[root]);
}
long long get_sum(int root, int L, int R) {
  if (tree[root].l > R || tree[root].r < L) return 0;
  if (L <= tree[root].l && tree[root].r <= R) return tree[root].sum;
  long long ans = get_sum(tree[root].child_left, L, R);
  mod(ans, get_sum(tree[root].child_right, L, R));
  return ans;
}
long long get_mul(int root, int L, int R) {
  if (tree[root].l > R || tree[root].r < L) return 0;
  if (tree[root].l >= L && R >= tree[root].r) return tree[root].mul;
  long long ans = get_mul(tree[root].child_left, L, R);
  mod(ans, get_mul(tree[root].child_right, L, R));
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  a.resize(n);
  w.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> w[i];
  int root = build(0, n - 1);
  for (int u = 0; u < q; ++u) {
    int x;
    cin >> x;
    if (x < 0) {
      int ind = -x;
      long long nw;
      cin >> nw;
      --ind;
      change(root, ind, nw);
    } else {
      int l = x, r;
      cin >> r;
      --l, --r;
      int L = l, R = r, k = r;
      long long cn = get_sum(root, L, R) / 2;
      while (R - L > 1) {
        int m = (L + R) / 2;
        if (get_sum(root, l, m) <= cn)
          L = m;
        else
          R = m, k = m;
      }
      long long elem = 0;
      mod(elem, (a[k] - k) * get_sum(root, l, k - 1));
      mod(elem, -get_mul(root, l, k - 1));
      mod(elem, get_mul(root, k + 1, r));
      mod(elem, -(a[k] - k) * get_sum(root, k + 1, r));
      cout << elem << "\n";
    }
  }
  return 0;
}
