#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
const long long mod = (int)1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ksm(long long a, long long b, long long mod) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long inv2(long long a, long long mod) { return ksm(a, mod - 2, mod); }
void exgcd(long long a, long long b, long long &x, long long &y, long long &d) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, y, x, d);
    y -= x * (a / b);
  }
}
const int MAX_N = 200025;
long long s[MAX_N << 2], sum[MAX_N << 2], arr[MAX_N], b[MAX_N], w[MAX_N];
int n;
void up(int rt) {
  sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
  s[rt] = s[rt << 1] + s[rt << 1 | 1];
}
void build(int rt, int l, int r) {
  sum[rt] = s[rt] = 0;
  if (l == r) {
    sum[rt] = w[l];
    s[rt] = b[l] * w[l] % 1000000007;
    return;
  }
  build(rt << 1, l, ((l + r) >> 1));
  build(rt << 1 | 1, ((l + r) >> 1) + 1, r);
  up(rt);
}
void update(int rt, int l, int r, int x, int v) {
  if (l == r) {
    sum[rt] = v;
    s[rt] = 1ll * b[x] * v % 1000000007;
    return;
  }
  if (x <= ((l + r) >> 1))
    update(rt << 1, l, ((l + r) >> 1), x, v);
  else
    update(rt << 1 | 1, ((l + r) >> 1) + 1, r, x, v);
  up(rt);
}
long long query(int rt, int l, int r, int x, int y) {
  if (x > r || y < l) return 0;
  if (x <= l && r <= y) {
    return sum[rt];
  }
  if (x > ((l + r) >> 1))
    return query(rt << 1 | 1, ((l + r) >> 1) + 1, r, x, y);
  else if (y <= ((l + r) >> 1))
    return query(rt << 1, l, ((l + r) >> 1), x, y);
  else
    return query(rt << 1, l, ((l + r) >> 1), x, y) +
           query(rt << 1 | 1, ((l + r) >> 1) + 1, r, x, y);
}
long long ask(int rt, int l, int r, int x, int y) {
  if (x > r || y < l) return 0;
  if (x <= l && r <= y) {
    return s[rt];
  }
  if (x > ((l + r) >> 1))
    return ask(rt << 1 | 1, ((l + r) >> 1) + 1, r, x, y);
  else if (y <= ((l + r) >> 1))
    return ask(rt << 1, l, ((l + r) >> 1), x, y);
  else
    return (ask(rt << 1, l, ((l + r) >> 1), x, y) % 1000000007 +
            ask(rt << 1 | 1, ((l + r) >> 1) + 1, r, x, y) % 1000000007) %
           1000000007;
}
long long solve(int x, int y) {
  int l = x, r = y, pos = l;
  while (l <= r) {
    long long tmp = query(1, 1, n, x, ((l + r) >> 1)),
              tmp_ = query(1, 1, n, ((l + r) >> 1) + 1, y);
    if (tmp >= tmp_)
      pos = ((l + r) >> 1), r = ((l + r) >> 1) - 1;
    else
      l = ((l + r) >> 1) + 1;
  }
  long long tmp = (query(1, 1, n, x, pos - 1) % 1000000007 *
                       ((arr[pos] - pos + 1000000007) % 1000000007) -
                   ask(1, 1, n, x, pos - 1) + 1000000007) %
                  1000000007;
  long long tmp_ = (query(1, 1, n, pos + 1, y) % 1000000007 *
                        ((pos - arr[pos] + 1000000007) % 1000000007) +
                    ask(1, 1, n, pos + 1, y) % 1000000007) %
                   1000000007;
  return ((tmp + tmp_) % 1000000007);
}
int main() {
  int Q, x;
  long long y;
  scanf("%d%d", &n, &Q);
  for (int i = 1; i <= n; ++i) scanf("%lld", &arr[i]), b[i] = arr[i] - i;
  for (int i = 1; i <= n; ++i) scanf("%lld", &w[i]);
  build(1, 1, n);
  while (Q--) {
    scanf("%d%lld", &x, &y);
    if (x < 0) {
      update(1, 1, n, -x, y);
    } else {
      printf("%lld\n", solve(x, y));
    }
  }
  return 0;
}
