#include <bits/stdc++.h>
using namespace std;
int n, q;
const int N = 2e5 + 10;
const int Mod = 1e9 + 7;
void inc(int &x, int y) {
  x += y;
  x = x >= Mod ? x - Mod : x;
}
struct Binary_Indexed_Tree {
  long long c[N];
  int lowbit(int x) { return x & (-x); }
  void add(int x, int w) {
    while (x <= n) {
      c[x] += w;
      x += lowbit(x);
    }
  }
  long long sum(int x) {
    long long ret = 0;
    while (x) {
      ret += c[x];
      x -= lowbit(x);
    }
    return ret;
  }
} T, S;
int w[N], a[N];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++)
    T.add(i, w[i]), S.add(i, 1ll * (a[i] - i) * w[i] % Mod);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      T.add(x, y - w[x]);
      S.add(x, 1ll * (a[x] - x) * (y - w[x] + Mod) % Mod);
      w[x] = y;
    } else {
      long long lw = T.sum(x - 1), sumw = T.sum(y) - lw;
      int l = x, r = y;
      while (l < r) {
        int mid = (l + r) / 2;
        if ((T.sum(mid) - lw) * 2 >= sumw)
          r = mid;
        else
          l = mid + 1;
      }
      long long ans = S.sum(x - 1) + S.sum(y) - 2ll * S.sum(l);
      ans = ans + (2ll * T.sum(l) - T.sum(x - 1) - T.sum(y)) % Mod * (a[l] - l);
      ans = (ans % Mod + Mod) % Mod;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
