#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int MAXN = 2e5 + 10;
const long long M = 1e9 + 7;
int n, q;
long long tw[MAXN], taw[MAXN];
int a[MAXN], w[MAXN];
void updAW(int i, int val) {
  for (; i < MAXN; i |= i + 1) {
    taw[i] = (taw[i] + val) % M;
    taw[i] = (taw[i] + M) % M;
  }
}
int getAW(int r) {
  int total = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) {
    total = (total + taw[r]) % M;
  }
  return total;
}
void updW(int i, int val) {
  for (; i < MAXN; i |= i + 1) {
    tw[i] += val;
  }
}
long long getW(int r) {
  long long total = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) {
    total += tw[r];
  }
  return total;
}
void update(int i, int newW) {
  updW(i, -w[i]);
  updAW(i, -(w[i] * 1ll * a[i]) % M);
  w[i] = newW;
  updW(i, w[i]);
  updAW(i, (w[i] * 1ll * a[i]) % M);
}
int ans(int L, int R) {
  if (L == R) return 0;
  long long sumW = getW(R) - getW(L - 1);
  int l = L, r = R;
  while (l < r) {
    int m = (l + r + 1) / 2;
    long long sum = getW(m - 1) - getW(L - 1);
    if (sum * 2 <= sumW && (sumW - sum) * 2 <= sumW) {
      l = r = m;
    } else if (sum * 2 > sumW) {
      r = m - 1;
    } else {
      l = m;
    }
  }
  long long suml = (getW(l - 1) - getW(L - 1)), sumr = (getW(R) - getW(l)) % M;
  long long sumAWl = (getAW(l - 1) - getAW(L - 1) + M) % M;
  long long sumAWr = (getAW(R) - getAW(l) + M) % M;
  return ((suml * a[l] % M - sumAWl + M) % M +
          (sumAWr - sumr * a[l] % M + M) % M) %
         M;
}
int32_t 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++) {
    int x;
    scanf("%d", &x);
    update(i, x);
  }
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      update(-l, r);
    } else {
      cout << ans(l, r) << "\n";
    }
  }
}
