#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 100100, INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
int n, q, a[MAXN], w[MAXN], x, y;
long long f1(int k) {
  long long ret = 0;
  for (int i = x; i < k; i++) ret += 1LL * ((a[k] - (k - i)) - a[i]) * w[i];
  return ret;
}
long long f2(int k) {
  long long ret = 0;
  for (int i = y; k < i; --i) ret += 1LL * (a[i] - (a[k] + (i - k))) * w[i];
  return ret;
}
long long bs() {
  int beg = x, end = y, mid;
  while (beg < end) {
    mid = (beg + end) >> 1;
    if (f1(mid) > f2(mid)) {
      if (end == mid) break;
      end = mid;
    } else {
      if (beg == mid) break;
      beg = mid;
    }
  }
  beg--, end++;
  long long ret = LINF;
  for (int i = beg; i <= end; ++i) ret = min(ret, f1(i) + f2(i));
  return ret;
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  while (q--) {
    scanf("%d %d", &x, &y);
    if (x > 0)
      printf("%d\n", bs() % MOD);
    else
      w[-x] = y;
  }
}
