#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
int n, q;
long long a[200015], w[200015], c[200015];
long long c2[200015];
inline int lb(int x) { return x & -x; }
void add(int p, long long x) {
  for (; p <= n; p += lb(p)) c[p] += x;
}
void add2(int p, long long x) {
  for (; p <= n; p += lb(p)) c2[p] += x;
}
long long query(int p) {
  long long res = 0;
  for (; p; p -= lb(p)) res += c[p];
  return res;
}
long long query2(int p) {
  long long res = 0;
  for (; p; p -= lb(p)) res += c2[p];
  return res;
}
long long cal(int p, int l, int r) {
  long long res1, res2;
  res1 = query2(r) - query2(p);
  res1 -= (long long)(query(r) - query(p)) * a[p];
  res2 = query2(p) - query2(l - 1);
  res2 = (long long)(query(p) - query(l - 1)) * a[p] - res2;
  return res1 + res2;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    a[i] -= i;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &w[i]);
  }
  for (int i = 1; i <= n; ++i) {
    add(i, w[i]);
    add2(i, w[i] * a[i]);
  }
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      add(-l, r - w[-l]);
      add2(-l, (long long)(r - w[-l]) * a[-l]);
      w[-l] = r;
    } else {
      int s = l, e = r;
      int ml, mr;
      long long res = 1e18;
      while (l <= r - 3) {
        ml = (2 * l + r) / 3;
        mr = (l + 2 * r) / 3;
        if (cal(ml, s, e) < cal(mr, s, e)) {
          r = mr;
        } else {
          l = ml;
        }
      }
      for (int i = l; i <= r; ++i) {
        long long tt = cal(i, s, e);
        if (tt < res) res = tt;
      }
      printf("%d\n", (int)(res % MOD));
    }
  }
  return 0;
}
