#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 10, mod = 1e9 + 7;
pair<long long, long long> p[maxn];
struct Fenwick {
  long long sm[maxn];
  void add(int ind, long long x, bool is) {
    if (is) x %= mod;
    while (ind < maxn) {
      sm[ind] += x;
      if (is) sm[ind] %= mod;
      ind += (ind & -ind);
    }
  }
  long long ask(int ind, bool is) {
    long long ans = 0;
    while (ind > 0) {
      ans += sm[ind];
      if (is) ans %= mod;
      ind -= (ind & -ind);
    }
    return ans;
  }
};
Fenwick fen1, fen2;
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = int(1); i <= int(n); i++) {
    scanf("%lld", &p[i].first);
    p[i].first -= i;
  }
  for (int i = int(1); i <= int(n); i++) {
    scanf("%lld", &p[i].second);
  }
  for (int i = int(1); i <= int(n); i++) {
    fen1.add(i, p[i].first * p[i].second, 1);
    fen2.add(i, p[i].second, 0);
  }
  while (q--) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    if (a < 0) {
      a = -a;
      fen1.add(a, -p[a].first * p[a].second, 1);
      fen2.add(a, -p[a].second, 0);
      p[a].second = b;
      fen1.add(a, p[a].first * p[a].second, 1);
      fen2.add(a, p[a].second, 0);
    } else {
      long long bf = fen2.ask(a - 1, 0);
      long long tot = fen2.ask(b, 0) - bf;
      long long l = a, r = b, ans = -1;
      while (l <= r) {
        int mid = (l + r) / 2;
        if ((2 * (fen2.ask(mid, 0) - bf)) >= tot) {
          ans = mid;
          r = mid - 1;
        } else {
          l = mid + 1;
        }
      }
      long long ANS = (p[ans].first * (2 * (fen2.ask(ans, 0) - bf) - tot) -
                       2 * fen1.ask(ans, 1) + fen1.ask(b, 1)) %
                      mod;
      if (ANS < 0) ANS += mod;
      printf("%lld\n", ANS);
    }
  }
}
