#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
inline long long pow(long long a, long long b, long long p) {
  long long rtn = 1;
  while (b) {
    if (b & 1) rtn = rtn * a % p;
    a = a * a % p;
    b >>= 1;
  }
  return rtn;
}
long long inv(long long a, long long p) { return pow(a, p - 2, p); }
long long gcd(long long a, long long b) {
  long long k;
  while (b != 0) {
    k = b;
    b = a % b;
    a = k;
  }
  return a;
}
void makedata() {
  freopen("input.txt", "w", stdout);
  srand((unsigned)time(NULL));
  fclose(stdout);
}
template <typename T>
class SegmentTree {
 private:
  T *data, *lazy;
  int type, ll, rr;
  inline void pushup(int rt) {
    if (type == 0)
      data[rt] = data[rt << 1] + data[((rt << 1) | 1)];
    else if (type == 1)
      data[rt] = max(data[rt << 1], data[((rt << 1) | 1)]);
    else if (type == 2)
      data[rt] = min(data[rt << 1], data[((rt << 1) | 1)]);
  }
  inline void pushdown(int rt, T m) {
    if (lazy[rt] == 0) return;
    lazy[rt << 1] += lazy[rt];
    lazy[((rt << 1) | 1)] += lazy[rt];
    if (type == 0) {
      data[rt << 1] += (m - (m >> 1)) * lazy[rt];
      data[((rt << 1) | 1)] += (m >> 1) * lazy[rt];
    } else if (type == 1) {
      data[rt << 1] += lazy[rt];
      data[((rt << 1) | 1)] += lazy[rt];
    } else if (type == 2) {
      data[rt << 1] += lazy[rt];
      data[((rt << 1) | 1)] += lazy[rt];
    }
    lazy[rt] = 0;
  }
  void build_(T *base, int l, int r, int rt) {
    lazy[rt] = 0;
    if (l == r)
      data[rt] = base[l];
    else {
      int mid = (l + r) >> 1;
      build_(base, l, mid, rt << 1);
      build_(base, mid + 1, r, ((rt << 1) | 1));
      pushup(rt);
    }
  }
  void modify_(int l, int r, int rt, int L, int R, T v) {
    if (L <= l && r <= R) {
      lazy[rt] += v;
      if (type == 0)
        data[rt] += v * (r - l + 1);
      else if (type == 1)
        data[rt] += v;
      else if (type == 2)
        data[rt] += v;
      return;
    }
    pushdown(rt, r - l + 1);
    int mid = (l + r) >> 1;
    if (L <= mid) modify_(l, mid, rt << 1, L, R, v);
    if (R > mid) modify_(mid + 1, r, ((rt << 1) | 1), L, R, v);
    pushup(rt);
  }
  T query_(int l, int r, int rt, int val) {
    if (l == r) return data[rt];
    pushdown(rt, r - l + 1);
    int mid = (l + r) >> 1;
    T ret = 0;
    if (val <= mid)
      ret = query_(l, mid, rt << 1, val);
    else
      ret = query_(mid + 1, r, ((rt << 1) | 1), val);
    pushup(rt);
    return ret;
  }
  T query_(int l, int r, int rt, int L, int R) {
    pushdown(rt, r - l + 1);
    if (L == l && R == r) return data[rt];
    int mid = (l + r) >> 1;
    if (R <= mid) return query_(l, mid, rt << 1, L, R);
    if (mid < L) return query_(mid + 1, r, ((rt << 1) | 1), L, R);
    if (type == 0)
      return query_(l, mid, rt << 1, L, mid) +
             query_(mid + 1, r, ((rt << 1) | 1), mid + 1, R);
    else if (type == 1)
      return max(query_(l, mid, rt << 1, L, mid),
                 query_(mid + 1, r, ((rt << 1) | 1), mid + 1, R));
    else if (type == 2)
      return min(query_(l, mid, rt << 1, L, mid),
                 query_(mid + 1, r, ((rt << 1) | 1), mid + 1, R));
  }

 public:
  SegmentTree(int n, int t)
      : data(new T[n << 3]), lazy(new T[n << 3]), type(t) {}
  void build(T *base, int l, int r) {
    ll = l, rr = r;
    build_(base, ll, rr, 1);
  }
  void modify(int l, int r, int v) {
    if (l > r || l < ll || rr < r) return;
    modify_(ll, rr, 1, l, r, v);
  }
  void modify(int p, int v) {
    if (p < ll || rr < p) return;
    modify_(ll, rr, 1, p, p, v);
  }
  T query(int l, int r) {
    if (l > r || l < ll || rr < r) return (T)(-1);
    return query_(ll, rr, 1, l, r);
  }
  T query(int p) {
    if (p < ll || rr < p) return (T)(-1);
    return query(ll, rr, 1, p);
  }
  ~SegmentTree() { delete[] data, delete[] lazy; }
};
SegmentTree<long long> sw(220000, 0), swa(220000, 0);
const long long mod = 1000000007;
long long a[220000], w[220000], wa[220000];
int main() {
  std::ios::sync_with_stdio(0), cin.tie(0);
  int n, q, x, y, l, r, k;
  cin >> n >> q;
  for (int i = (1); i <= (n); i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = (1); i <= (n); i++) {
    cin >> w[i];
    wa[i] = w[i] * a[i] % mod;
  }
  sw.build(w, 1, n);
  swa.build(wa, 1, n);
  for (int i = (1); i <= (q); i++) {
    cin >> x >> y;
    if (x < 0) {
      sw.modify(-x, y - w[-x]);
      swa.modify(-x, (y - w[-x]) * a[-x]);
      w[-x] = y;
    } else {
      long long sxy = sw.query(x, y) / 2;
      l = x, r = y;
      while (l + 1 < r) {
        k = (l + r) / 2;
        if (sw.query(x, k) <= sxy)
          l = k;
        else
          r = k;
      }
      k = l + 1;
      long long ans = 0;
      if (x < k) {
        ans = (((ans) + (a[k] * sw.query(x, k - 1)) % mod) % (mod) + mod) % mod;
        ans = (((ans) + (-1 * swa.query(x, k - 1)) % mod) % (mod) + mod) % mod;
      }
      if (k < y) {
        ans = (((ans) + (-1 * a[k] * sw.query(k + 1, y)) % mod) % (mod) + mod) %
              mod;
        ans = (((ans) + (swa.query(k + 1, y)) % mod) % (mod) + mod) % mod;
      }
      cout << (ans) << endl;
    }
  }
  return 0;
}
