#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
int n;
int q;
vector<long long int> v;
vector<long long int> w;
long long int bit[300002];
void add(int i, long long int x) {
  i++;
  while (i < 300002) {
    bit[i] += x;
    i += i & -i;
  }
}
long long int sum(int i) {
  i++;
  long long int r = 0;
  while (i) {
    r += bit[i];
    i -= i & -i;
  }
  return r;
}
long long int rng(int l, int r) {
  long long int sm = sum(r);
  if (l) sm -= sum(l - 1);
  return sm;
}
long long int pf[300002];
void pf_add(int i, long long int x) {
  x %= 1000000007;
  x += 1000000007;
  x %= 1000000007;
  i++;
  while (i < 300002) {
    pf[i] += x;
    if (pf[i] >= 1000000007) pf[i] %= 1000000007;
    i += i & -i;
  }
}
long long int pf_sum(int i) {
  i++;
  long long int r = 0;
  while (i) {
    r += pf[i];
    if (r >= 1000000007) r %= 1000000007;
    i -= i & -i;
  }
  return r;
}
long long int sf[300002];
void sf_add(int i, long long int x) {
  i++;
  x %= 1000000007;
  x += 1000000007;
  x %= 1000000007;
  while (i < 300002) {
    sf[i] += x;
    if (sf[i] >= 1000000007) sf[i] %= 1000000007;
    i += i & -i;
  }
}
long long int sf_sum(int i) {
  i++;
  long long int r = 0;
  while (i) {
    r += sf[i];
    if (r >= 1000000007) r %= 1000000007;
    i -= i & -i;
  }
  return r;
}
int main() {
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    v.push_back(a);
  }
  int rngg = n;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    w.push_back(a);
    add(i, a);
    pf_add(i, -(v[i] + rngg) * a);
    sf_add(i, (v[i] - i) * a);
    rngg--;
  }
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x *= -1;
      x--;
      add(x, -w[x]);
      pf_add(x, (v[x] + (n - x)) * w[x]);
      sf_add(x, -(v[x] - x) * w[x]);
      w[x] = y;
      add(x, w[x]);
      pf_add(x, -(v[x] + (n - x)) * w[x]);
      sf_add(x, (v[x] - x) * w[x]);
    } else {
      int l = x;
      int r = y;
      l--;
      r--;
      int mint = l;
      int maxt = r;
      long long int ALL = (rng(l, r) + 1LL) / 2LL;
      while (mint + 1 < maxt) {
        int mid = (mint + maxt) / 2;
        if (rng(l, mid) >= ALL) {
          maxt = mid;
        } else {
          mint = mid;
        }
      }
      if (rng(l, mint) >= ALL) {
        maxt = mint;
      } else {
        mint = maxt;
      }
      long long int act = n - mint;
      long long int cs1 =
          ((((sum(mint) - sum(l - 1)) % 1000000007 + 1000000007) % 1000000007) *
           (v[mint] + act) % 1000000007) +
          ((((pf_sum(mint) - pf_sum(l - 1)) % 1000000007) + 1000000007) %
           1000000007);
      act = mint;
      cs1 %= 1000000007;
      long long int cs2 =
          ((sf_sum(r) - sf_sum(mint - 1) % 1000000007 + 1000000007) %
           1000000007) -
          ((((sum(r) - sum(mint - 1)) % 1000000007 + 1000000007) % 1000000007) *
           (v[mint] - act) % 1000000007);
      cs2 %= 1000000007;
      cs1 += cs2;
      cs1 %= 1000000007;
      cs1 += 1000000007;
      cs1 %= 1000000007;
      printf("%lld\n", cs1);
    }
  }
  return 0;
}
