#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
long long c[N], sum[N << 2], w[N], sum_fn[N << 2];
int n, a[N];
int lowbit(int x) { return x & -x; }
void upd(int x, int val) {
  for (; x <= n; x += lowbit(x)) c[x] += val;
}
long long get_sum(int x) {
  long long ans = 0;
  for (; x; x -= lowbit(x)) ans += c[x];
  return ans;
}
void build(int l, int r, int rt) {
  if (l == r) {
    sum[rt] = w[l] * l % mod;
    sum_fn[rt] = w[l] * a[l] % mod;
    return;
  }
  int mid = l + r >> 1;
  build(l, mid, (rt << 1));
  build(mid + 1, r, (rt << 1 | 1));
  sum[rt] = (sum[(rt << 1)] + sum[(rt << 1 | 1)]) % mod;
  sum_fn[rt] = (sum_fn[(rt << 1)] + sum_fn[(rt << 1 | 1)]) % mod;
}
void update(int l, int r, int x, int val, int rt) {
  if (l == r) {
    sum[rt] = val * 1ll * l % mod;
    sum_fn[rt] = val * 1ll * a[l] % mod;
    return;
  }
  int mid = l + r >> 1;
  if (x <= mid)
    update(l, mid, x, val, (rt << 1));
  else
    update(mid + 1, r, x, val, (rt << 1 | 1));
  sum[rt] = (sum[(rt << 1)] + sum[(rt << 1 | 1)]) % mod;
  sum_fn[rt] = (sum_fn[(rt << 1)] + sum_fn[(rt << 1 | 1)]) % mod;
}
pair<long long, long long> query(int l, int r, int L, int R, int rt) {
  if (L <= l && r <= R) return make_pair(sum[rt], sum_fn[rt]);
  int mid = l + r >> 1;
  pair<long long, long long> ans = make_pair(0ll, 0ll);
  if (L <= mid) {
    pair<long long, long long> res = query(l, mid, L, R, (rt << 1));
    ans.first = (ans.first + res.first) % mod;
    ans.second = (ans.second + res.second) % mod;
  }
  if (mid < R) {
    pair<long long, long long> res = query(mid + 1, r, L, R, (rt << 1 | 1));
    ans.first = (ans.first + res.first) % mod;
    ans.second = (ans.second + res.second) % mod;
  }
  return ans;
}
int main() {
  int q;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &w[i]), upd(i, w[i]);
  build(1, n, 1);
  while (q--) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x < 0) {
      x = -x;
      update(1, n, x, y, 1);
      upd(x, y - w[x]);
      w[x] = y;
    } else {
      long long pr = get_sum(x - 1), sb = get_sum(y);
      int l = x, r = y, ans = -1;
      while (l <= r) {
        int mid = l + r >> 1;
        long long res = get_sum(mid);
        if (res - pr >= sb - res) {
          ans = mid;
          r = mid - 1;
        } else
          l = mid + 1;
      }
      long long su = 0;
      long long w_ans = get_sum(ans);
      if (ans < y) {
        pair<long long, long long> p = query(1, n, ans + 1, y, 1);
        su += (p.second - p.first -
               (sb - w_ans) % mod * 1ll * (a[ans] - ans) % mod) %
              mod;
      }
      if (ans >= x) {
        pair<long long, long long> p = query(1, n, x, ans, 1);
        su += (p.first - p.second +
               (w_ans - pr) % mod * 1ll * (a[ans] - ans) % mod) %
              mod;
      }
      su %= mod;
      su = (su + mod) % mod;
      printf("%lld\n", su);
    }
  }
  return 0;
}
