#include <bits/stdc++.h>
using namespace std;
const int BASE = 1e9;
const int MAXN = 2e5;
const long long oops = 1LL << 62;
const int MOD = 1e9 + 7;
int weights[MAXN + 5];
int A[MAXN + 5];
int n;
struct BIT {
  long long weights[MAXN + 5];
  long long weightIndex[MAXN + 5];
  long long weightAsc[MAXN + 5], weightDesc[MAXN + 5];
  void update(int ix, long long v) {
    for (int i = ix + 1; i <= n; i += i & -i) {
      weights[i] += v;
      weightIndex[i] += v * A[ix];
      weightAsc[i] += v * ix;
      weightDesc[i] += v * (n - ix - 1);
    }
  }
  long long queryWeights(int i) {
    long long ret = 0;
    for (i++; i > 0; i -= i & -i) ret += weights[i];
    return ret;
  }
  long long queryWeights(int s, int e) {
    return queryWeights(e) - queryWeights(s - 1);
  }
  long long queryWeightIndex(int i) {
    long long ret = 0;
    for (i++; i > 0; i -= i & -i) ret += weightIndex[i];
    return ret;
  }
  long long queryWeightIndex(int s, int e) {
    return queryWeightIndex(e) - queryWeightIndex(s - 1);
  }
  long long queryAsc(int i) {
    long long ret = 0;
    for (i++; i > 0; i -= i & -i) ret += weightAsc[i];
    return ret;
  }
  long long queryAsc(int s, int e) { return queryAsc(e) - queryAsc(s - 1); }
  long long queryDesc(int i) {
    long long ret = 0;
    for (i++; i > 0; i -= i & -i) ret += weightDesc[i];
    return ret;
  }
  long long queryDesc(int s, int e) { return queryDesc(e) - queryDesc(s - 1); }
};
BIT bit;
int Q;
long long calcLeft(int s, int e) {
  if (s > e) return 0;
  int i = e + 1;
  long long Wleft = bit.queryWeights(s, e);
  long long Lsum = bit.queryWeightIndex(s, e);
  long long Wdesc = bit.queryDesc(s, e) - (n - e - 2) * Wleft;
  int p = A[i];
  return p * Wleft - Lsum - Wdesc;
}
long long calcRight(int s, int e) {
  if (s > e) return 0;
  int i = s - 1;
  long long Wright = bit.queryWeights(s, e);
  long long Rsum = bit.queryWeightIndex(s, e);
  long long Wasc = bit.queryAsc(s, e) - (s - 1) * Wright;
  int p = A[i];
  return Rsum - p * Wright - Wasc;
}
long long solve(int from, int to) {
  if (from == to) return 0;
  int s = from, e = to;
  long long ret = oops;
  while (s <= e) {
    int mid = s + e >> 1;
    long long left = calcLeft(from, mid - 1);
    long long right = calcRight(mid + 1, to);
    ret = min(ret, left + right);
    if (left > right)
      e = mid - 1;
    else
      s = mid + 1;
  }
  return ret;
}
int main() {
  int c, c2;
  scanf("%d%d", &n, &Q);
  for (c = 0; c < n; c++) scanf("%d", &A[c]);
  for (c = 0; c < n; c++) {
    scanf("%d", &weights[c]);
    bit.update(c, weights[c]);
  }
  for (c = 0; c < Q; c++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a < 0) {
      int i = -a - 1;
      bit.update(i, b - weights[i]);
      weights[i] = b;
    } else {
      a--;
      b--;
      printf("%I64d\n", solve(a, b) % MOD);
    }
  }
  return 0;
}
