#include <bits/stdc++.h>
using namespace std;
inline void P(int& x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
}
int n, q;
int a[200001], w[200001];
long long b1[200001];
int b2[200001];
void Add1(int i, int x) {
  for (; i <= n; i += i & -i) b1[i] += x;
}
void Add2(int i, int x) {
  for (; i <= n; i += i & -i) P(b2[i], x);
}
long long Qur1(int i) {
  long long A = 0;
  for (; i; i -= i & -i) A += b1[i];
  return A;
}
int Qur2(int i) {
  int A = 0;
  for (; i; i -= i & -i) P(A, b2[i]);
  return A;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= (n); ++i) scanf("%d", a + i), a[i] -= i;
  for (int i = 1; i <= (n); ++i) scanf("%d", w + i);
  for (int i = 1; i <= (n); ++i)
    Add2(i, (long long)a[i] * w[i] % 1000000007), Add1(i, w[i]);
  for (int i = 1; i <= (q); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      Add1(-x, y - w[-x]);
      Add2(-x, (long long)a[-x] * (y - w[-x] + 1000000007) % 1000000007);
      w[-x] = y;
    } else {
      int l = x, r = y, mid, ans = -1;
      long long Left = Qur1(x - 1), Sum = Qur1(r) - Left;
      while (l <= r) {
        mid = l + r >> 1;
        if (Qur1(mid - 1) - Left << 1 <= Sum)
          ans = mid, l = mid + 1;
        else
          r = mid - 1;
      }
      printf("%d\n", (((Qur1(ans - 1) - Left - Qur1(y) + Qur1(ans)) %
                           1000000007 * a[ans] % 1000000007 -
                       (Qur2(ans - 1) - Qur2(x - 1)) + (Qur2(y) - Qur2(ans))) %
                          1000000007 +
                      1000000007) %
                         1000000007);
    }
  }
  return 0;
}
