#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const long long MAXN = 1e6 + 7;
const double EPS = 1e-8;
long long n, q;
void add(long long &x, long long y) {
  x = (x + y) % INF;
  if (x < 0) x += INF;
}
struct Tree {
  vector<long long> t;
  bool fl;
  void relax(long long v) {
    t[v] = t[2 * v] + t[2 * v + 1];
    if (fl) {
      if (t[v] >= INF) {
        t[v] -= INF;
      }
      if (t[v] < 0) {
        t[v] += INF;
      }
    }
  }
  void build(vector<long long> &a, long long l = 0, long long r = n,
             long long v = 1) {
    if (r - l == 1) {
      t[v] = (a[l] % INF + INF) % INF;
      return;
    }
    long long m = (l + r) / 2;
    build(a, l, m, 2 * v);
    build(a, m, r, 2 * v + 1);
    relax(v);
  }
  Tree(vector<long long> &a, bool fl) : fl(fl) {
    t.resize(4 * n, 0);
    build(a, 0, n, 1);
  }
  long long get(long long l, long long r, long long tl = 0, long long tr = n,
                long long v = 1) {
    if (l >= tr || tl >= r) {
      return 0;
    }
    if (l <= tl && tr <= r) {
      return t[v];
    }
    long long tm = (tl + tr) / 2;
    long long sum = get(l, r, tl, tm, 2 * v) + get(l, r, tm, tr, 2 * v + 1);
    if (fl) {
      sum %= INF;
      if (sum >= INF) {
        sum -= INF;
      } else if (sum < 0) {
        sum += INF;
      }
    }
    return sum;
  }
  pair<long long, long long> force(long long l, long long sum, long long tl = 0,
                                   long long tr = n, long long v = 1) {
    if (tr <= l) {
      return {-1, 0};
    }
    if (t[v] < sum && tl >= l) {
      return {-1, t[v]};
    }
    if (tr - tl == 1) {
      return {tl, t[v]};
    }
    long long tm = (tl + tr) / 2;
    auto p = force(l, sum, tl, tm, 2 * v);
    if (p.first != -1) {
      return p;
    }
    auto p1 = force(l, sum - p.second, tm, tr, 2 * v + 1);
    return {p1.first, p1.second + p.second};
  }
  void change(long long p, long long x, long long tl = 0, long long tr = n,
              long long v = 1) {
    if (tl > p || tr <= p) {
      return;
    }
    if (tr - tl == 1) {
      t[v] = (x % INF + INF) % INF;
      return;
    }
    long long tm = (tl + tr) / 2;
    change(p, x, tl, tm, 2 * v);
    change(p, x, tm, tr, 2 * v + 1);
    relax(v);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  vector<long long> a(n), w(n), b(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> w[i];
    b[i] = (a[i] - i) * w[i];
  }
  Tree tw(w, false);
  Tree tb(b, true);
  for (long long i = 0; i < q; i++) {
    long long x, y;
    cin >> x >> y;
    if (x < 0) {
      x = abs(x) - 1;
      tw.change(x, y);
      tb.change(x, (a[x] - x) * y);
    } else {
      long long l = x - 1, r = y - 1;
      long long sum = tw.get(l, r + 1);
      auto p = tw.force(l, (sum + 1) / 2);
      assert(p.first != -1);
      long long pos = p.first;
      long long res = 0;
      add(res, tw.get(pos + 1, r + 1) * (pos - a[pos]));
      add(res, tb.get(pos + 1, r + 1));
      add(res, tw.get(l, pos) * (a[pos] - pos));
      add(res, -tb.get(l, pos));
      cout << res << "\n";
    }
  }
}
