#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
int n, q;
long long a[N], w[N], c[N << 1][2];
inline void add(int x, long long v, int id) {
  if (!id)
    for (; x <= n; x += x & -x) c[x][id] += v;
  else
    for (; x <= n; x += x & -x) c[x][id] = (c[x][id] + v + mod) % mod;
}
inline long long ask(int x, int id) {
  long long ret = 0;
  if (!id)
    for (; x; x -= x & -x) ret += c[x][id];
  else
    for (; x; x -= x & -x) ret = (ret + c[x][id] + mod) % mod;
  return ret;
}
inline long long gets(int x, int y, int id) {
  if (!id)
    return y >= x ? ask(y, id) - ask(x - 1, id) : 0;
  else
    return (ask(y, id) - ask(x - 1, id) + mod) % mod;
}
inline int bsearch(int x, int y) {
  int l = x, r = y, mid;
  while (l < r) {
    mid = (l + r) / 2;
    if (gets(x, mid, 0) >= gets(mid + 1, y, 0))
      r = mid;
    else
      l = mid + 1;
  }
  return r;
}
int main() {
  scanf("%d%d", &n, &q);
  for (register int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (register int i = 1; i <= n; i++)
    scanf("%lld", &w[i]), add(i, w[i], 0), add(i, w[i] * (a[i] - i), 1);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      add(x, -w[x], 0);
      add(x, -w[x] * (a[x] - x), 1);
      w[x] = y;
      add(x, w[x], 0);
      add(x, w[x] * (a[x] - x), 1);
    } else {
      if (x == y) {
        puts("0");
        continue;
      }
      long long pos = bsearch(x, y), ans = 0;
      ans = (ans + (gets(x, pos, 0) % mod) * (int)abs(a[pos] - pos) % mod -
             gets(x, pos, 1) + mod) %
            mod;
      ans = (ans - (gets(pos, y, 0) % mod) * (int)abs(a[pos] - pos) % mod +
             gets(pos, y, 1) + mod) %
            mod;
      printf("%lld\n", ans);
    }
  }
  return 0;
}
