#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx,tune=native")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
template <typename T>
int bins(vector<T> &v, T key) {
  int imin = 0, imax = v.size();
  while (imin < imax) {
    int imid = (imin + imax) >> 1;
    if (v[imid] < key)
      imin = imid + 1;
    else
      imax = imid;
  }
  return imin;
}
const int mn = 2e5 + 4;
inline int _norm(int x) {
  if (x < 0) x += MOD;
  return x;
}
template <int MOD>
struct ModInt {
  static const int Mod = MOD;
  unsigned x;
  ModInt() : x(0) {}
  ModInt(signed sig) {
    sig = _norm(sig);
    x = sig;
  }
  ModInt(signed long long sig) {
    sig = _norm(sig);
    x = sig;
  }
  int get() const { return (int)x; }
  ModInt &operator+=(ModInt that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(ModInt that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(ModInt that) {
    x = ((unsigned long long)x * that.x) % MOD;
    return *this;
  }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt &operator+=(int that) {
    that = _norm(that);
    if ((x += that) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(int that) {
    that = _norm(that);
    if ((x += MOD - that) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(int that) {
    that = _norm(that);
    x = ((unsigned long long)x * that) % MOD;
    return *this;
  }
  ModInt &operator/=(int that) {
    that = _norm(that);
    return *this *= ModInt(that).inverse();
  }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  ModInt operator+(int that) const { return ModInt(*this) += that; }
  ModInt operator-(int that) const { return ModInt(*this) -= that; }
  ModInt operator*(int that) const { return ModInt(*this) *= that; }
  ModInt operator/(int that) const { return ModInt(*this) /= that; }
  ModInt inverse() const {
    signed a = x, b = MOD, u = 1, v = 0;
    while (b) {
      signed t = a / b;
      a -= t * b;
      std::swap(a, b);
      u -= t * v;
      std::swap(u, v);
    }
    if (u < 0) u += Mod;
    ModInt res;
    res.x = (unsigned)u;
    return res;
  }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  ModInt operator-() const {
    ModInt t;
    t.x = x == 0 ? 0 : Mod - x;
    return t;
  }
};
template <int MOD>
ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
  ModInt<MOD> r = 1;
  while (k) {
    if (k & 1) r *= a;
    a *= a;
    k >>= 1;
  }
  return r;
}
template <int _SEGSZ>
class ModSegTree {
 public:
  static const int SEGSZ = _SEGSZ;
  int segn = _SEGSZ;
  int t[2 * SEGSZ];
  int identity = 0;
  int combine(const int &lefts, const int &rights) {
    int ans = lefts + rights;
    if (ans >= MOD) ans -= MOD;
    return ans;
  }
  void init(int n) { segn = n; }
  void build() {
    int n = segn;
    for (int i = n - 1; i > 0; --i) t[i] = combine(t[i << 1], t[i << 1 | 1]);
  }
  void sset(int p, const long long value) {
    int n = segn;
    for (t[p += n] = value % MOD; p >>= 1;)
      t[p] = combine(t[p << 1], t[p << 1 | 1]);
  }
  ModInt<MOD> query(int l, int r) {
    if (l > r) return identity;
    r++;
    int n = segn;
    int resl = identity, resr = identity;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) resl = combine(resl, t[l++]);
      if (r & 1) resr = combine(t[--r], resr);
    }
    return ModInt<MOD>(combine(resl, resr));
  }
};
template <int _SEGSZ>
class SegTree {
 public:
  static const int SEGSZ = _SEGSZ;
  int segn = _SEGSZ;
  long double t[2 * SEGSZ];
  long double identity = 0;
  long double combine(const long double lefts, const long double rights) {
    return lefts + rights;
  }
  void init(int n) { segn = n; }
  void build() {
    int n = segn;
    for (int i = n - 1; i > 0; --i) t[i] = combine(t[i << 1], t[i << 1 | 1]);
  }
  void sset(int p, const long double value) {
    int n = segn;
    for (t[p += n] = value; p >>= 1;) t[p] = combine(t[p << 1], t[p << 1 | 1]);
  }
  long double query(int l, int r) {
    if (l > r) return identity;
    r++;
    int n = segn;
    long double resl = identity, resr = identity;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) resl = combine(resl, t[l++]);
      if (r & 1) resr = combine(t[--r], resr);
    }
    return combine(resl, resr);
  }
};
class AtLeastSegTree {
 public:
  static const int SEGSZ = 1 << 18;
  const int MAXSEG = SEGSZ + 1;
  const int segn = SEGSZ;
  long long t[2 * SEGSZ + 2];
  long long identity = 0;
  long long combine(const long long &lefts, const long long &rights) {
    return lefts + rights;
  }
  void build() {
    int n = segn;
    for (int i = n - 1; i > 0; --i) t[i] = combine(t[i << 1], t[i << 1 | 1]);
  }
  void sset(int p, const long long &value) {
    int n = segn;
    for (t[p += n] = value; p >>= 1;) t[p] = combine(t[p << 1], t[p << 1 | 1]);
  }
  long long query(int l, int r) {
    if (l > r) return identity;
    r++;
    int n = segn;
    long long resl = identity, resr = identity;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) resl = combine(resl, t[l++]);
      if (r & 1) resr = combine(t[--r], resr);
    }
    return combine(resl, resr);
  }
  int _fatleast(long long atleast, int l, int r, int p) {
    if (l + 1 == r) return l;
    int m = (l + r) >> 1;
    if (atleast <= t[p << 1]) {
      return _fatleast(atleast, l, m, p << 1);
    } else {
      return _fatleast(atleast - t[p << 1], m, r, (p << 1) | 1);
    }
  }
  int fatleast(long long atleast) { return _fatleast(atleast, 0, segn, 1); }
};
SegTree<mn> segwx, segw, segwi;
ModSegTree<mn> msegwx, msegw, msegwi;
AtLeastSegTree asegw;
int x[mn];
int w[mn];
int n;
long double f(int l, int r, long double s) {
  int imin = l, imax = r + 1;
  while (imin < imax) {
    int imid = (imin + imax) >> 1;
    if (x[imid] < s + imid - l) {
      imin = imid + 1;
    } else
      imax = imid;
  }
  int mid = imin;
  long double ansR =
      segwx.query(mid, r) - segw.query(mid, r) * (s - l) - segwi.query(mid, r);
  long double ansL = (segw.query(l, mid - 1) * (s - l) +
                      segwi.query(l, mid - 1) - segwx.query(l, mid - 1));
  return ansL + ansR;
}
ModInt<MOD> mf(int l, int r, int s) {
  int imin = l, imax = r + 1;
  while (imin < imax) {
    int imid = (imin + imax) >> 1;
    if (x[imid] < s + imid - l) {
      imin = imid + 1;
    } else
      imax = imid;
  }
  int mid = imin;
  ModInt<MOD> ansR = msegwx.query(mid, r) - msegw.query(mid, r) * (s - l) -
                     msegwi.query(mid, r);
  ModInt<MOD> ansL = (msegw.query(l, mid - 1) * (s - l) +
                      msegwi.query(l, mid - 1) - msegwx.query(l, mid - 1));
  return ansL + ansR;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  n = rint();
  int q = rint();
  segwx.init(n);
  segw.init(n);
  segwi.init(n);
  msegwx.init(n);
  msegw.init(n);
  msegwi.init(n);
  for (int i = 0; i < n; i++) x[i] = rint();
  for (int i = 0; i < n; i++) w[i] = rint();
  for (int i = 0; i < n; i++) {
    long long wx = w[i] * (long long)x[i];
    long long wi = w[i] * (long long)i;
    asegw.t[asegw.segn + i] = w[i];
    segw.t[n + i] = w[i];
    segwx.t[n + i] = wx;
    segwi.t[n + i] = wi;
    msegw.t[n + i] = w[i] % MOD;
    msegwx.t[n + i] = wx % MOD;
    msegwi.t[n + i] = wi % MOD;
  }
  asegw.build();
  segw.build();
  segwx.build();
  segwi.build();
  msegw.build();
  msegwx.build();
  msegwi.build();
  for (int qi = 0; qi < q; qi++) {
    int q1 = rint(), q2 = rint();
    if (q1 < 0) {
      int i = -q1 - 1;
      int nw = q2;
      w[i] = nw;
      long long wx = w[i] * (long long)x[i];
      long long wi = w[i] * (long long)i;
      asegw.sset(i, w[i]);
      segw.sset(i, w[i]);
      segwx.sset(i, wx);
      segwi.sset(i, wi);
      msegw.sset(i, w[i]);
      msegwx.sset(i, wx);
      msegwi.sset(i, wi);
    } else {
      int l = q1 - 1, r = q2 - 1;
      long long allw = asegw.query(l, r);
      long long medw = asegw.query(0, l - 1) + (allw / 2);
      int est_medidx = asegw.fatleast(medw);
      int est_medS = x[est_medidx] - (est_medidx - l);
      set<int> vs;
      const int K = 2;
      for (int medidx = max(est_medidx - K, l);
           medidx <= min(est_medidx + K, r); medidx++) {
        int medS = x[medidx] - (medidx - l);
        for (int t = medS - K; t <= medS + K; t++) vs.insert(t);
      }
      pair<long double, int> best;
      bool hit = false;
      for (auto &s : vs) {
        if (hit)
          chkmin(best, make_pair(f(l, r, s), s));
        else {
          best = make_pair(f(l, r, s), s);
          hit = true;
        }
      }
      ModInt<MOD> ans = mf(l, r, best.second);
      printf("%d\n", ans.get());
    }
  }
}
static char stdinBuffer[1024];
static char *stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char *stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
