#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
const long long MOD = 1e9 + 7;
int n;
long long a[N], b[N];
long long fenw[2][N];
inline void upd(int v, long long x, int f) {
  for (int i = v; i <= n; i += (i & (-i))) {
    if (f == 0)
      fenw[f][i] += x;
    else
      fenw[f][i] = (fenw[f][i] + x + MOD + MOD) % MOD;
  }
}
inline long long get(int v, int f) {
  long long ans = 0;
  for (int i = v; i >= 1; i -= (i & (-i))) {
    if (f == 0)
      ans += fenw[f][i];
    else
      ans = (ans + fenw[f][i] + MOD) % MOD;
  }
  return ans;
}
inline long long getSum(int l, int r, int f) {
  if (l > r) return 0;
  if (f == 0) return get(r, f) - get(l - 1, f);
  return (get(r, f) - get(l - 1, f) + MOD) % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> n >> tt;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = (a[i] - i + MOD + MOD) % MOD;
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    upd(i, b[i], 0);
    upd(i, (a[i] * b[i]) % MOD, 1);
  }
  while (tt--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x *= -1;
      upd(x, -b[x], 0);
      upd(x, -((a[x] * b[x]) % MOD), 1);
      b[x] = y;
      upd(x, b[x], 0);
      upd(x, (a[x] * b[x]) % MOD, 1);
    } else {
      int l = x, r = y;
      long long mySum = getSum(l, r, 0);
      while (l < r) {
        int mid = (l + r) >> 1;
        if (getSum(x, mid, 0) * 2 > mySum)
          r = mid;
        else
          l = mid + 1;
      }
      int k = l;
      long long ans;
      ans = ((a[k] * getSum(x, k - 1, 0)) % MOD - getSum(x, k - 1, 1) + MOD) %
            MOD;
      ans = (ans +
             (getSum(k + 1, y, 1) - (a[k] * getSum(k + 1, y, 0)) % MOD + MOD) %
                 MOD) %
            MOD;
      cout << ans << "\n";
    }
  }
}
