#include <bits/stdc++.h>
using namespace std;
using LL = long long;
struct Finwick {
  int n, logn;
  LL C[200005];
  void init(int x) { logn = sizeof(int) * 8 - __builtin_clz(n = x) - 1; }
  LL sum(int x, int o = 0) {
    LL res = 0;
    while (x) {
      res += C[x], x -= x & -x;
      if (o) res %= 1000000007;
    }
    return res;
  }
  void add(int x, LL d, int o = 0) {
    while (x <= n) {
      C[x] += d, x += x & -x;
      if (o) C[x] %= 1000000007;
    }
  }
  int lower_bound(LL v) {
    LL sum = 0;
    int pos = 0;
    for (int i = logn; i >= 0; i--)
      if ((pos | 1 << i) <= n && sum + C[pos | 1 << i] < v)
        sum += C[pos |= 1 << i];
    return pos + 1;
  }
} F, H;
int n, q, pos, x, y;
LL ans, w[200005], a[200005];
int main() {
  scanf("%d%d", &n, &q);
  F.init(n), H.init(n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++)
    scanf("%d", &w[i]), F.add(i, w[i]),
        H.add(i, w[i] * (a[i] - i + 1000000007) % 1000000007, 1);
  while (q--) {
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      F.add(x, y - w[x]);
      H.add(x,
            ((y - w[x] + 1000000007) % 1000000007 * (a[x] - x + 1000000007) %
             1000000007) %
                1000000007,
            1);
      w[x] = y;
    } else {
      pos = F.lower_bound(F.sum(y) + F.sum(x - 1) >> 1);
      ans = (F.sum(pos - 1, 1) - F.sum(x - 1, 1) + 1000000007) *
                (a[pos] - pos + 1000000007) % 1000000007 +
            1000000007 - H.sum(pos - 1, 1) + H.sum(x - 1, 1);
      ans += (-F.sum(y, 1) + F.sum(pos, 1) + 1000000007) *
                 (a[pos] - pos + 1000000007) % 1000000007 +
             1000000007 + H.sum(y, 1) - H.sum(pos, 1);
      printf("%lld\n", ans % 1000000007);
    }
  }
  return 0;
}
