#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int N = 200100;
long long a[N];
template <typename T, bool K>
struct SegtreeLD {
  vector<T> t;
  int n, h;
  SegtreeLD() {}
  SegtreeLD(int sz) {
    h = 32 - __builtin_clz(sz);
    n = 1 << h;
    t = vector<T>(n << 1);
  }
  void assign(int x, T v) {
    x += n;
    t[x] = v;
    for (x /= 2; x; x /= 2) {
      t[x] = t[x << 1] + t[x << 1 | 1];
    }
  }
  T query(int l, int r) {
    T ans = 0;
    for (l += n, r += n; l < r; l /= 2, r /= 2) {
      if (l % 2) {
        ans += t[l++];
      }
      if (r % 2) {
        ans += t[--r];
      }
    }
    return ans;
  }
};
template <typename T, bool K>
struct Segtree {
  vector<T> t;
  int n, h;
  Segtree() {}
  Segtree(int sz) {
    h = 32 - __builtin_clz(sz);
    n = 1 << h;
    t = vector<T>(n << 1);
  }
  void assign(int x, T v) {
    int y = x;
    x += n;
    t[x] = v;
    for (x /= 2; x; x /= 2) {
      t[x] = t[x << 1] + t[x << 1 | 1];
    }
    if (K) {
      for (y += n; y; y /= 2) {
        t[y] %= MOD;
      }
    }
  }
  T query(int l, int r) {
    T ans = 0;
    for (l += n, r += n; l < r; l /= 2, r /= 2) {
      if (l % 2) {
        ans += t[l++];
      }
      if (r % 2) {
        ans += t[--r];
      }
    }
    if (K) {
      ans %= MOD;
    }
    return ans;
  }
  pair<int, T> bs(int l, int r, T goal, int x, int lv, int rv) {
    if (rv <= l || r <= lv) {
      return {-1, 0};
    }
    if (l <= lv && rv <= r && t[x] < goal) {
      return {-1, t[x]};
    }
    if (rv - lv == 1 && t[x] >= goal) {
      return {lv, t[x]};
    }
    int mv = (lv + rv) / 2;
    auto res = bs(l, r, goal, x * 2, lv, mv);
    if (res.first != -1) {
      return res;
    }
    T ov = res.second;
    res = bs(l, r, goal - res.second, x * 2 + 1, mv, rv);
    return {res.first, res.second + ov};
  }
  int bs(int l, int r, T goal) {
    auto res = bs(l, r, goal, 1, 0, n);
    return res.first;
  }
};
Segtree<long long, false> weights;
Segtree<long long, true> modsum;
SegtreeLD<long double, false> floatsum;
int n, q;
long long calc(long long x, int l, int r) {
  long long* pt = lower_bound(a + 1, a + n + 1, x);
  int ind = pt - a;
  ind = max(l, min(r + 1, ind));
  long long ans = (weights.query(l, ind) * x % MOD) - modsum.query(l, ind);
  ans %= MOD;
  ans += modsum.query(ind, r + 1) - (weights.query(ind, r + 1) * x % MOD);
  ans = (ans % MOD + MOD) % MOD;
  return ans;
}
long long getDiff(int ind1, int ind2, int l, int r) {
  if (ind2 > n) {
    return 1e9;
  }
  long long x = a[ind1];
  long long y = a[ind2];
  assert(y >= x);
  ind1 = max(l, min(r + 1, ind1));
  ind2 = max(l, min(r + 1, ind2));
  long long ans =
      (y - x) * weights.query(l, ind1) + (x - y) * weights.query(ind2, r + 1);
  for (int i = ind1; i < ind2; ++i) {
    ans += (x + y - 2 * a[i]) * weights.query(i, i + 1);
  }
  return ans;
}
long long query(int l, int r) {
  long long tot_weight = weights.query(l, r + 1);
  int loi = weights.bs(l, r + 1, tot_weight / 2);
  if (loi > 1) {
    loi--;
  }
  long long val = calc(a[loi], l, r);
  pair<long long, long long> ans = {0, val};
  long long d1 = getDiff(loi, loi + 1, l, r);
  ans = min(ans, {d1, (val + d1 % MOD + MOD) % MOD});
  long long d2 = getDiff(loi, loi + 2, l, r);
  ans = min(ans, {d2, (val + d2 % MOD + MOD) % MOD});
  return ans.second;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> q;
  weights = Segtree<long long, false>(n + 1);
  modsum = Segtree<long long, true>(n + 1);
  floatsum = SegtreeLD<long double, false>(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    weights.assign(i, x);
    modsum.assign(i, x * (a[i]) % MOD);
    floatsum.assign(i, (long double)x * (a[i]));
  }
  for (int qq = 0; qq < q; ++qq) {
    int x, y;
    cin >> x >> y;
    if (x > 0) {
      int l = x, r = y;
      cout << query(l, r) << "\n";
    } else {
      x *= -1;
      weights.assign(x, y);
      modsum.assign(x, y * (a[x]) % MOD);
      floatsum.assign(x, (long double)y * (a[x]));
    }
  }
  return 0;
}
