#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int data = 0, w = 1;
  char ch = 0;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') w = -1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    data = (data << 1) + (data << 3) + (ch ^ 48), ch = getchar();
  return data * w;
}
const int mod = 1e9 + 7;
int n;
namespace SUM {
long long c[1000005];
void add(int x, long long v) {
  for (int i = x; i <= n; i += i & -i) c[i] += v;
}
long long ask(int x) {
  long long ans = 0;
  for (int i = x; i; i -= i & -i) ans += c[i];
  return ans;
}
long long Query(int l, int r) { return ask(r) - ask(l - 1); }
};  // namespace SUM
void fix(int &x) {
  x -= mod;
  x += x >> 31 & mod;
}
namespace Mul {
int c[1000005];
void add(int x, int v) {
  for (int i = x; i <= n; i += i & -i) fix(c[i] += v);
}
int ask(int x) {
  int ans = 0;
  for (int i = x; i; i -= i & -i) fix(ans += c[i]);
  return ans;
}
int Query(int l, int r) { return (ask(r) - ask(l - 1) + mod) % mod; }
};  // namespace Mul
int q, a[1000005], w[1000005];
int main() {
  n = read();
  q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++)
    w[i] = read(), SUM::add(i, w[i]),
    Mul::add(i, 1ll * w[i] * (a[i] - i) % mod);
  while (q--) {
    int x = read(), y = read();
    if (x < 0) {
      x = -x;
      SUM::add(x, -w[x] + y),
          Mul::add(x, 1ll * (-w[x] + y + mod) * (a[x] - x) % mod);
      w[x] = y;
    } else {
      int l = x, r = y, pos = 0;
      while (l <= r) {
        int mid = l + r >> 1;
        if (SUM::Query(x, mid) >= SUM::Query(mid + 1, y))
          pos = mid, r = mid - 1;
        else
          l = mid + 1;
      }
      int Ans = (-Mul::Query(x, pos) +
                 1ll * (a[pos] - pos) * (SUM::Query(x, pos) % mod) % mod + mod -
                 1ll * (a[pos] - pos) * (SUM::Query(pos, y) % mod) % mod +
                 Mul::Query(pos, y) + mod) %
                mod;
      cout << Ans << '\n';
    }
  }
  return 0;
}
