#include <bits/stdc++.h>
using namespace std;
const int maxn = 200200;
const long long P = 1e9 + 7;
int n, q;
long long a[maxn], w[maxn], sum[2 * maxn], cost[2 * maxn];
vector<long long> ans;
int log2(int x) {
  int ret = 0;
  int t = 0;
  while (x >= 2) {
    if (x % 2 == 1) t = 1;
    x /= 2;
    ret++;
  }
  return ret + t;
}
int pow2(int x) {
  int ret = 1;
  for (int i = 0; i < x; i++) {
    ret *= 2;
  }
  return ret;
}
void makeTree() {
  int height = log2(n), counter = 1;
  int num = pow2(height);
  int tempN = 1;
  while (num >= 1) {
    for (int i = 0; i < tempN; i++) {
      for (int j = 0; j < num; j++) {
        sum[counter] += w[i * num + j];
        cost[counter] +=
            (w[i * num + j] * (a[i * num + j] - a[i * num] - j)) % P;
        cost[counter] %= P;
      }
      counter++;
    }
    num /= 2;
    tempN *= 2;
  }
}
void changeTree(int id, long long nw) {
  long long dw = nw - w[id];
  w[id] += dw;
  int counter = 1;
  int helpC = 1;
  int tempN = pow2(log2(n));
  while (tempN >= 1) {
    sum[counter] += dw;
    cost[counter] += (dw * (a[id] - a[id - (id % tempN)] - (id % tempN))) % P;
    cost[counter] %= P;
    helpC *= 2;
    tempN /= 2;
    if (tempN == 0) break;
    counter = helpC + id / tempN;
  }
}
long long getWeight(int l, int r) {
  int num = pow2(log2(n));
  long long ret = 0;
  while (l < r) {
    if (l % 2 == 1) {
      ret += sum[l + num];
      l++;
    }
    if (r % 2 == 0) {
      ret += sum[r + num];
      r--;
    }
    l /= 2;
    r /= 2;
    num /= 2;
  }
  if (l == r) ret += sum[r + num];
  return ret;
}
int getAnsPoint(int l, int r) {
  int tl = l, tr = r;
  while (tr - tl > 1) {
    int mid = (tr + tl) / 2;
    if (getWeight(l, mid) < getWeight(mid + 1, r))
      tl = mid + 1;
    else
      tr = mid;
  }
  if (getWeight(l, tl) > getWeight(tr, r)) return tl;
  return tr;
}
long long getCostRight(int l, int p) {
  int num = pow2(log2(n));
  int pw = 1;
  int r = p - 1;
  long long ret = 0;
  while (l < r) {
    if (l % 2 == 1) {
      ret += (sum[l + num] * (a[(l + 1) * pw - 1] - a[l * pw] - pw + 1) -
              cost[l + num]) %
                 P +
             ((a[p] - p - a[(l + 1) * pw - 1] + ((l + 1) * pw - 1)) *
              sum[l + num]) %
                 P;
      ret %= P;
      l++;
    }
    if (r % 2 == 0) {
      ret += (sum[r + num] * (a[(r + 1) * pw - 1] - a[r * pw] - pw + 1) -
              cost[r + num]) %
                 P +
             ((a[p] - p - a[(r + 1) * pw - 1] + ((r + 1) * pw - 1)) *
              sum[r + num]) %
                 P;
      ret %= P;
      r--;
    }
    l /= 2;
    r /= 2;
    num /= 2;
    pw *= 2;
  }
  if (l == r)
    ret +=
        (sum[r + num] * (a[(r + 1) * pw - 1] - a[r * pw] - pw + 1) -
         cost[r + num]) %
            P +
        ((a[p] - p - a[(r + 1) * pw - 1] + ((r + 1) * pw - 1)) * sum[r + num]) %
            P;
  ret %= P;
  return ret;
}
long long getCostLeft(int p, int r) {
  int num = pow2(log2(n));
  int pw = 1;
  int l = p + 1;
  long long ret = 0;
  while (l < r) {
    if (l % 2 == 1) {
      ret +=
          cost[l + num] + ((a[l * pw] - a[p] - l * pw + p) * sum[l + num]) % P;
      ret %= P;
      l++;
    }
    if (r % 2 == 0) {
      ret +=
          cost[r + num] + ((a[r * pw] - a[p] - r * pw + p) * sum[r + num]) % P;
      ret %= P;
      r--;
    }
    l /= 2;
    r /= 2;
    num /= 2;
    pw *= 2;
  }
  if (l == r)
    ret += cost[r + num] + ((a[r * pw] - a[p] - r * pw + p) * sum[r + num]) % P;
  ret %= P;
  return ret;
}
long long getMinCost(int l, int r) {
  int point = getAnsPoint(l, r);
  return (getCostRight(l, point) + getCostLeft(point, r)) % P;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  makeTree();
  for (int i = 0; i < q; i++) {
    int x;
    long long y;
    cin >> x >> y;
    if (x < 0)
      changeTree(-x - 1, y);
    else
      ans.push_back(getMinCost(x - 1, y - 1));
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
