#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  T s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = (s << 3) + (s << 1) + ch - 48;
    ch = getchar();
  }
  return s * f;
}
template <typename T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
const int N = 2e5 + 100;
const int mod = 1e9 + 7;
long long w[N], a[N];
struct Segment {
  static const int MAX = 2e5 + 100;
  long long sum[MAX << 2];
  void pushup(int node, int l, int r) {
    sum[node] = sum[node << 1] + sum[node << 1 | 1];
  }
  void build(int node, int l, int r) {
    if (l == r) {
      sum[node] = w[l];
      return;
    }
    int mid = l + r >> 1;
    build(node << 1, l, mid);
    build(node << 1 | 1, mid + 1, r);
    pushup(node, l, r);
  }
  void change(int node, int l, int r, int idx, int val) {
    if (l == r) {
      sum[node] = val;
      return;
    }
    int mid = l + r >> 1;
    if (idx <= mid)
      change(node << 1, l, mid, idx, val);
    else
      change(node << 1 | 1, mid + 1, r, idx, val);
    pushup(node, l, r);
  }
  int queryid(int node, int l, int r, int L, int R, long long val) {
    if (l == r) return l;
    int mid = l + r >> 1;
    if (R <= mid)
      return queryid(node << 1, l, mid, L, R, val);
    else if (L > mid)
      return queryid(node << 1 | 1, mid + 1, r, L, R, val);
    else {
      long long lsum = querysum(node << 1, l, mid, L, mid);
      if (lsum >= val)
        return queryid(node << 1, l, mid, L, mid, val);
      else
        return queryid(node << 1 | 1, mid + 1, r, mid + 1, R, val - lsum);
    }
  }
  long long querysum(int node, int l, int r, int L, int R) {
    if (L <= l && R >= r) {
      return sum[node];
    }
    int mid = l + r >> 1;
    long long val = 0;
    if (L <= mid) val += querysum(node << 1, l, mid, L, R);
    if (R > mid) val += querysum(node << 1 | 1, mid + 1, r, L, R);
    return val;
  }
} treeans;
struct SegmentTree {
  static const int MAX = 2e5 + 100;
  long long sum[MAX << 2];
  void pushup(int node, int l, int r) {
    sum[node] = sum[node << 1] + sum[node << 1 | 1] % mod;
  }
  void build(int node, int l, int r) {
    if (l == r) {
      sum[node] = w[l] * (a[l] - l) % mod;
      return;
    }
    int mid = l + r >> 1;
    build(node << 1, l, mid);
    build(node << 1 | 1, mid + 1, r);
    pushup(node, l, r);
  }
  void change(int node, int l, int r, int idx, long long val) {
    if (l == r) {
      sum[node] = val * (a[l] - l) % mod;
      return;
    }
    int mid = l + r >> 1;
    if (idx <= mid)
      change(node << 1, l, mid, idx, val);
    else
      change(node << 1 | 1, mid + 1, r, idx, val);
    pushup(node, l, r);
  }
  long long querysum(int node, int l, int r, int L, int R) {
    if (L <= l && R >= r) {
      return sum[node] % mod;
    }
    int mid = l + r >> 1;
    long long val = 0;
    if (L <= mid) val += querysum(node << 1, l, mid, L, R), val %= mod;
    if (R > mid) val += querysum(node << 1 | 1, mid + 1, r, L, R), val %= mod;
    return val % mod;
  }
} tree;
int main() {
  int n = read<int>(), m = read<int>();
  for (int i = 1; i <= n; ++i) {
    a[i] = read<long long>();
  }
  for (int i = 1; i <= n; ++i) {
    w[i] = read<long long>();
  }
  tree.build(1, 1, n);
  treeans.build(1, 1, n);
  for (int i = 1; i <= m; ++i) {
    long long l = read<long long>(), r = read<long long>();
    if (l < 0) {
      l = -l;
      tree.change(1, 1, n, l, r);
      treeans.change(1, 1, n, l, r);
      w[l] = r;
    } else {
      long long k = treeans.querysum(1, 1, n, l, r);
      if (k & 1) {
        k = (k + 1) / 2;
        long long id = treeans.queryid(1, 1, n, l, r, k);
        unsigned long long ans = 0;
        ans = ((1LL * ((a[id] - id) % mod) *
                (treeans.querysum(1, 1, n, l, id) % mod)) %
                   mod -
               1LL * tree.querysum(1, 1, n, l, id) % mod + mod) %
              mod;
        ans = (ans + 1LL * tree.querysum(1, 1, n, id, r) % mod -
               1LL *
                   ((a[id] - id) % mod *
                    (treeans.querysum(1, 1, n, id, r) % mod)) %
                   mod +
               mod) %
              mod;
        printf("%lld\n", (long long)ans % mod);
      } else {
        k /= 2;
        int idone = treeans.queryid(1, 1, n, l, r, k);
        int idtwo = treeans.queryid(1, 1, n, l, r, k + 1);
        long long valmidlf = (a[idone] + a[idtwo]) / 2;
        long long valmidrt = valmidlf;
        if (idone != idtwo) valmidrt += 1;
        unsigned long long ans = 0;
        ans = (1LL * (valmidlf - idone) % mod *
                   (treeans.querysum(1, 1, n, l, idone) % mod) % mod -
               1LL * tree.querysum(1, 1, n, l, idone) % mod + mod) %
              mod;
        ans = (ans + 1LL * tree.querysum(1, 1, n, idtwo, r) % mod -
               1LL * (valmidrt - idtwo) % mod *
                   (treeans.querysum(1, 1, n, idtwo, r) % mod) % mod +
               mod) %
              mod;
        printf("%lld\n", (long long)ans % mod);
      }
    }
  }
}
