#include <bits/stdc++.h>
using namespace std;
int n, q;
const int maxn = 2e5 + 5, md = 1e9 + 7;
int pos[maxn], wei[maxn];
struct Fenwick_Tree {
  long long c[maxn];
  void add(int p, int x) {
    for (; p <= n; p += p & (-p)) c[p] = (c[p] + x);
  }
  long long s(int p) {
    long long result = 0;
    for (; p; p -= p & (-p)) result = (result + c[p]);
    return result;
  }
  long long s2(int p) {
    long long result = 0;
    for (; p; p -= p & (-p)) result = (result + c[p]) % md;
    return result;
  }
} tr, tr2;
signed main() {
  scanf("%d%d", &n, &q);
  for (int i = (1); i <= (n); ++i) scanf("%d", pos + i), pos[i] -= i;
  for (int i = (1); i <= (n); ++i) {
    scanf("%d", wei + i);
    tr.add(i, wei[i]);
    tr2.add(i, 1ll * wei[i] * pos[i] % md);
  }
  long long ans = 0;
  for (int i = (1); i <= (q); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a < 0) {
      a = -a;
      tr.add(a, -wei[a]);
      tr2.add(a, -1ll * wei[a] * pos[a] % md);
      tr.add(a, b);
      tr2.add(a, b * 1ll * pos[a] % md);
      wei[a] = b;
    } else {
      int l = a - 1, r = b, mid;
      long long stot = tr.s(b) - tr.s(a - 1) + 1;
      while (r - l > 1) {
        mid = (l + r) >> 1;
        if (tr.s(mid) - tr.s(a - 1) <= tr.s(b) - tr.s(mid - 1)) {
          l = mid;
        } else {
          r = mid;
        }
      }
      a -= 1;
      ans = 1ll * tr.s(r) * 2 % md * pos[r] % md -
            (tr.s(b) + tr.s(a)) % md * pos[r] % md + md;
      ans %= md;
      ans += (tr2.s2(b) - tr2.s2(r)) % md - (tr2.s2(r) - tr2.s2(a)) % md;
      ans %= md;
      ans = (ans + md) % md;
      printf("%lld\n", ans);
    }
  }
  return 0;
}
