#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)2e5 + 3;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const long long inf = (long long)1e15;
long long n, a[MAXN], q, w[MAXN];
long long mul(long long a, long long b) {
  a %= MOD, b %= MOD;
  long long c = 1LL * a * b;
  c %= MOD;
  return c;
}
long long add(long long a, long long b) {
  a %= MOD, b %= MOD;
  long long c = a + b;
  if (c < 0) c += MOD;
  if (c >= MOD) c -= MOD;
  return c;
}
struct segment {
  long long seg[2 * MAXN];
  void build(bool toMOD) {
    for (int i = n - 1; i > 0; i--) {
      if (toMOD == 0)
        seg[i] = seg[i << 1] + seg[i << 1 | 1];
      else
        seg[i] = add(seg[i << 1], seg[i << 1 | 1]);
    }
  }
  void update(int idx, long long v, bool toMOD) {
    for (seg[idx += n] = v; idx > 0; idx >>= 1) {
      if (toMOD == 0)
        seg[idx >> 1] = seg[idx] + seg[idx ^ 1];
      else
        seg[idx >> 1] = add(seg[idx], seg[idx ^ 1]);
    }
  }
  long long get(int l, int r, bool toMOD) {
    long long sum = 0;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) {
        if (toMOD == 0)
          sum += seg[l++];
        else
          sum = add(sum, seg[l++]);
      }
      if (r & 1) {
        if (toMOD == 0)
          sum += seg[--r];
        else
          sum = add(sum, seg[--r]);
      }
    }
    return sum;
  }
} sum, wei;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    sum.seg[i + n] = w[i];
    wei.seg[i + n] = mul(w[i], add(a[i], -i));
  }
  sum.build(0), wei.build(1);
  for (int i = 0; i < q; i++) {
    int type;
    cin >> type;
    if (type < 0) {
      long long idx, val;
      idx = -type;
      idx--;
      cin >> val;
      sum.update(idx, val, 0);
      wei.update(idx, mul(val, add(a[idx], -idx)), 1);
    } else {
      long long l, r;
      l = type;
      l--;
      cin >> r;
      int L = l - 1, R = r - 1;
      while (R - L > 1) {
        int mid = (L + R) >> 1;
        if (sum.get(l, mid + 1, 0) >= sum.get(mid + 1, r, 0))
          R = mid;
        else
          L = mid;
      }
      long long ans = 0;
      ans = add(mul(sum.get(l, R, 1), add(a[R], -R)), -wei.get(l, R, 1));
      ans = add(ans,
                add(wei.get(R, r, 1), -mul(sum.get(R, r, 1), add(a[R], -R))));
      cout << ans << "\n";
    }
  }
}
