#include <bits/stdc++.h>
using namespace std;
void getre() {
  int x = 0;
  printf("%d\n", 1 / x);
}
void gettle() {
  int res = 1;
  while (1) res <<= 1;
  printf("%d\n", res);
}
template <typename T, typename S>
inline bool upmin(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool upmax(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename N, typename PN>
inline N flo(N a, PN b) {
  return a >= 0 ? a / b : -((-a - 1) / b) - 1;
}
template <typename N, typename PN>
inline N cei(N a, PN b) {
  return a > 0 ? (a - 1) / b + 1 : -(-a / b);
}
template <typename N>
N gcd(N a, N b) {
  return b ? gcd(b, a % b) : a;
}
template <typename N>
inline int sgn(N a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
inline void gn(long long &x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gn(long double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gs(char *s) { scanf("%s", s); }
inline void gc(char &c) {
  while ((c = getchar()) > 126 || c < 33)
    ;
}
inline void pc(char c) { putchar(c); }
inline long long sqr(long long a) { return a * a; }
inline double sqrf(double a) { return a * a; }
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846264338327950288L;
const double eps = 1e-6;
const int mo = 1e9 + 7;
int n, q;
long long bit[222222];
int bit2[222222];
long long bitque(int x) {
  long long su = 0;
  for (; x; x -= x & -x) su += bit[x];
  return su;
}
int bit2que(int x) {
  int su = 0;
  for (; x; x -= x & -x)
    (((su) = ((su) + (bit2[x])) % mo) < 0 ? (su) += mo : (su));
  return su;
}
void bitupd(int x, long long del) {
  for (; x <= n; x += x & -x) bit[x] += del;
}
void bit2upd(int x, int del) {
  for (; x <= n; x += x & -x)
    (((bit2[x]) = ((bit2[x]) + (del)) % mo) < 0 ? (bit2[x]) += mo : (bit2[x]));
}
int a[222222], w[222222];
int main() {
  gn(n);
  gn(q);
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    gn(a[i]);
    a[i] += n - i;
  }
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    gn(w[i]);
    bitupd(i, w[i]);
    bit2upd(i, 1ll * a[i] * w[i] % mo);
  }
  while (q--) {
    int x, y;
    gn(x);
    gn(y);
    if (x < 0) {
      x = -x;
      int del = y - w[x];
      w[x] = y;
      bitupd(x, del);
      bit2upd(x, 1ll * a[x] * del % mo);
    } else {
      long long fa = bitque(y);
      long long left = bitque(x - 1);
      long long su = fa - left;
      long long th = (su + 1) / 2;
      long long want = th + left;
      int l = x, r = y;
      while (l <= r) {
        int mid = l + r >> 1;
        long long has = bitque(mid);
        if (has >= want)
          r = mid - 1;
        else
          l = mid + 1;
      }
      int rigsum = ((bit2que(y) - bit2que(l - 1)) -
                    1ll * (bitque(y) - bitque(l - 1)) % mo * a[l]) %
                   mo;
      int lefsum = (-(bit2que(l - 1) - bit2que(x - 1)) +
                    1ll * (bitque(l - 1) - bitque(x - 1)) % mo * a[l]) %
                   mo;
      int ret = ((0ll + rigsum + lefsum) % mo + mo) % mo;
      printf("%d\n", ret);
    }
  }
  return 0;
}
