#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 200010;
int _w;
void add_mod(int &a, int b) {
  a += b;
  a -= a >= MOD ? MOD : 0;
}
int lowb(int x) { return x & (-x); }
int n, q, a[N], w[N];
struct BIT {
  long long c[N];
  void init() { memset(c, 0, sizeof c); }
  void add(int p, int v) {
    for (; p <= n; p += lowb(p)) c[p] += v;
  }
  long long sum(int p) {
    long long s = 0;
    for (; p; p -= lowb(p)) s += c[p];
    return s;
  }
  long long sum(int l, int r) { return sum(r) - sum(l - 1); }
};
BIT bitw;
struct MODBIT {
  int c[N];
  void init() { memset(c, 0, sizeof c); }
  void add(int p, int v) {
    for (; p <= n; p += lowb(p)) add_mod(c[p], v);
  }
  int sum(int p) {
    int s = 0;
    for (; p; p -= lowb(p)) add_mod(s, c[p]);
    return s;
  }
  int sum(int l, int r) { return (sum(r) - sum(l - 1) + MOD) % MOD; }
};
MODBIT bitaw;
int _calc(int l, int r, int x) {
  x = a[x];
  int sub = bitaw.sum(l, r);
  int plus = int(bitw.sum(l, r) % MOD);
  x = int(1LL * x * plus % MOD);
  return (x - sub + MOD) % MOD;
}
int calc(int l, int r, int x) {
  int t1 = _calc(l, x, x);
  int t2 = _calc(x, r, x);
  t2 = (MOD - t2) % MOD;
  return (t1 + t2) % MOD;
}
void solve(int l, int r) {
  int low = l - 1, high = r;
  while (low < high) {
    int mid = (low + high + 1) / 2;
    long long lsum = bitw.sum(l, mid);
    long long rsum = bitw.sum(mid + 1, r);
    if (lsum <= rsum) {
      low = mid;
    } else {
      high = mid - 1;
    }
  }
  printf("%d\n", calc(l, r, low + 1));
}
int main() {
  _w = scanf("%d%d", &n, &q);
  bitaw.init();
  bitw.init();
  for (int i = 1; i <= n; ++i) {
    _w = scanf("%d", a + i);
    a[i] = (a[i] - i + MOD) % MOD;
  }
  for (int i = 1; i <= n; ++i) {
    _w = scanf("%d", w + i);
    bitw.add(i, w[i]);
    int tmp = int(1LL * a[i] * w[i] % MOD);
    bitaw.add(i, tmp);
  }
  while (q--) {
    int x, y;
    _w = scanf("%d%d", &x, &y);
    if (x < 0) {
      int id = -x;
      int delta = y - w[id];
      w[id] += delta;
      bitw.add(id, delta);
      delta = (delta + MOD) % MOD;
      int tmp = int(1LL * a[id] * delta % MOD);
      bitaw.add(id, tmp);
    } else {
      solve(x, y);
    }
  }
  return 0;
}
