#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
inline long long read() {
  long long t = 0, dp = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') dp = -1;
    c = getchar();
  }
  while (isdigit(c)) t = t * 10 + c - 48, c = getchar();
  return t * dp;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
inline void write_p(long long x) {
  write(x);
  putchar(' ');
}
long long mo = 1e9 + 7;
const int N = 200005;
long long n, que, a[N], w[N], tr1[N], tr2[N];
inline long long Ask1(long long x) {
  long long sum = 0;
  for (; x; x -= x & -x) sum = (sum + tr1[x] + mo) % mo;
  return sum;
}
inline long long Ask2(long long x) {
  long long sum = 0;
  for (; x; x -= x & -x) sum += tr2[x];
  return sum;
}
inline void Insert1(long long x, long long v) {
  for (; x <= n; x += x & -x) tr1[x] = (tr1[x] + v % mo + mo) % mo;
}
inline void Insert2(long long x, long long v) {
  for (; x <= n; x += x & -x) tr2[x] += v;
}
inline long long Query1(long long l, long long r) {
  return (Ask1(r) - Ask1(l - 1) + mo) % mo;
}
inline long long Query2(long long l, long long r) {
  return Ask2(r) - Ask2(l - 1);
}
inline bool check(long long l, long long r, long long mid) {
  long long t1 = Query2(l, mid), t2 = Query2(mid + 1, r);
  return t1 >= t2;
}
int main() {
  n = read();
  que = read();
  for (int i = 1; i <= n; ++i) a[i] = read() - i + 1;
  for (int i = 1; i <= n; ++i) w[i] = read();
  for (int i = 1; i <= n; ++i) Insert1(i, a[i] * w[i] % mo), Insert2(i, w[i]);
  for (int i = 1; i <= que; ++i) {
    long long ql = read(), qr = read();
    if (ql > 0) {
      long long l = ql, r = qr, ans = r;
      while (l <= r) {
        long long mid = l + r >> 1;
        if (check(ql, qr, mid))
          ans = mid, r = mid - 1;
        else
          l = mid + 1;
      }
      long long ANS =
          (Query2(ql, ans) % mo * a[ans] % mo - Query1(ql, ans)) % mo;
      ANS +=
          (-Query2(ans + 1, qr) % mo * a[ans] % mo + Query1(ans + 1, qr) % mo) %
          mo;
      ANS = (ANS % mo + mo) % mo;
      writeln(ANS);
    } else {
      ql = -ql;
      Insert1(ql, a[ql] * (qr - w[ql]) % mo);
      Insert2(ql, (qr - w[ql]));
      w[ql] = qr;
    }
  }
}
