#include <bits/stdc++.h>
using namespace std;
const int N = 200010, mod = 1000000007;
int a[N], b[N], n, Q;
struct bit {
  long long t[N];
  bool is;
  long long qry(int l, int r) {
    long long ret = 0;
    for (; r; r -= r & -r) ret += t[r];
    for (l--; l; l -= l & -l) ret -= t[l];
    if (is)
      return (ret % mod + mod) % mod;
    else
      return ret;
  }
  void add(int x, long long v) {
    if (is) v = (v % mod + mod) % mod;
    for (; x <= n; x += x & -x) {
      t[x] += v;
      if (is && t[x] >= mod) t[x] -= mod;
    }
  }
} p, q;
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] -= i;
  }
  q.is = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    p.add(i, b[i]);
    q.add(i, (long long)b[i] * a[i]);
  }
  for (; Q--;) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x > 0) {
      int l = x, r = y;
      if (l == r) {
        puts("0");
        continue;
      }
      while (l < r) {
        int mid = l + r >> 1;
        if (p.qry(x, mid) < p.qry(mid + 1, y))
          l = mid + 1;
        else
          r = mid;
      }
      long long ans = q.qry(l, y) - p.qry(l, y) * a[l] % mod;
      ans += p.qry(x, l) * a[l] % mod - q.qry(x, l);
      ans = (ans % mod + mod) % mod;
      printf("%lld\n", ans);
    } else {
      x = -x;
      p.add(x, -b[x]);
      q.add(x, -(long long)b[x] * a[x]);
      b[x] = y;
      p.add(x, b[x]);
      q.add(x, (long long)b[x] * a[x]);
    }
  }
}
