#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
struct SegtreeMOD {
  vector<long long> t;
  int n, h;
  SegtreeMOD() {}
  SegtreeMOD(int sz) {
    h = 32 - __builtin_clz(sz);
    n = 1 << h;
    t = vector<long long>(n << 1);
  }
  void assign(int x, long long v) {
    x += n;
    t[x] = v % MOD;
    for (x /= 2; x; x /= 2) {
      t[x] = (t[x << 1] + t[x << 1 | 1]);
      if (t[x] >= MOD) {
        t[x] -= MOD;
      }
    }
  }
  long long query(int l, int r) {
    long long 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 % MOD;
  }
};
struct Segtree {
  vector<long long> t;
  int n, h;
  Segtree() {}
  Segtree(int sz) {
    h = 32 - __builtin_clz(sz);
    n = 1 << h;
    t = vector<long long>(n << 1);
  }
  void assign(int x, long long v) {
    x += n;
    t[x] = v;
    for (x /= 2; x; x /= 2) {
      t[x] = t[x << 1] + t[x << 1 | 1];
    }
  }
  long long query(int l, int r) {
    long long 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;
  }
  pair<long long, int> bs(int l, int r, long long goal, int x, int lv, int rv) {
    if (rv <= l || r <= lv) {
      return {0, -1};
    }
    if (l <= lv && rv <= r) {
      if (t[x] < goal) {
        return {t[x], -1};
      }
      if (rv - lv == 1) {
        return {t[x], lv};
      }
    }
    int mv = (lv + rv) / 2;
    auto res1 = bs(l, r, goal, x * 2, lv, mv);
    if (res1.second != -1) {
      return res1;
    }
    auto res2 = bs(l, r, goal - res1.first, x * 2 + 1, mv, rv);
    return {res2.first + res1.first, res2.second};
  }
  int bs(int l, int r, long long goal) {
    return bs(l, r, goal, 1, 0, n).second;
  }
};
Segtree weights;
SegtreeMOD wx;
int n, q;
long long a[200200];
long long query(int l, int r) {
  long long wtot = weights.query(l, r + 1);
  int med = weights.bs(l, r + 1, (wtot + 1) / 2);
  long long ans = ((weights.query(l, med) * 2 - wtot) % MOD) * a[med] -
                  wx.query(l, med) + wx.query(med, r + 1);
  ans = (ans % MOD + MOD) % MOD;
  return ans % MOD;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> q;
  weights = Segtree(n + 1);
  wx = SegtreeMOD(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; ++i) {
    long long w;
    cin >> w;
    weights.assign(i, w);
    wx.assign(i, w * a[i]);
  }
  while (q--) {
    int _a, b;
    cin >> _a >> b;
    if (_a > 0) {
      cout << query(_a, b) << "\n";
    } else {
      int id = -_a, nw = b;
      weights.assign(id, nw);
      wx.assign(id, nw * a[id]);
    }
  }
  return 0;
}
