#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];
long long c1[200015], c2[200015];
inline int lb(int x) { return x & -x; }
void add1(int p, long long x) {
  for (; p <= n; p += lb(p)) c1[p] += x;
}
long long query1(int p) {
  long long res = 0;
  for (; p; p -= lb(p)) res += c1[p];
  return res;
}
void add2(int p, long long x) {
  for (; p <= n; p += lb(p)) {
    c2[p] += x;
    if (c2[p] >= MOD) c2[p] -= MOD;
  }
}
long long query2(int p) {
  long long res = 0;
  for (; p; p -= lb(p)) res += c2[p];
  return res % MOD;
}
int get_p(int l, int r) {
  long long r1 = query1(l - 1);
  long long r2 = query1(r) - r1;
  int mi, res = l;
  while (l <= r) {
    mi = l + r >> 1;
    if ((query1(mi) - r1) * 2 >= r2) {
      r = (res = mi) - 1;
    } else {
      l = mi + 1;
    }
  }
  return res;
}
long long cal(int l, int r, int p) {
  long long res1 =
      query2(r) - query2(p - 1) - (query1(r) - query1(p - 1)) % MOD * a[p];
  long long res2 =
      (query1(p) - query1(l - 1)) % MOD * a[p] - (query2(p) - query2(l - 1));
  return ((res1 + res2) % MOD + MOD) % MOD;
}
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) {
    add1(i, w[i]);
    add2(i, w[i] * a[i] % MOD);
  }
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      add1(-l, r - w[-l]);
      add2(-l, (r - w[-l]) * a[-l] % MOD);
      w[-l] = r;
    } else {
      int p = get_p(l, r);
      printf("%lld\n", cal(l, r, p));
    }
  }
  return 0;
}
