#include <bits/stdc++.h>
using namespace std;
long long acum[301009], wacum[301009], aw[301009];
long long read(int i, long long *tree, int mod = -1) {
  long long ret = 0;
  while (i > 0) {
    ret += tree[i];
    if (mod != -1) ret %= 1000000007;
    i -= (i & -i);
  }
  return ret;
}
void add(int i, int v, long long *tree, int maxi, int mod = -1) {
  while (i <= maxi) {
    tree[i] += v;
    if (mod != -1) tree[i] %= 1000000007;
    i += (i & -i);
  }
}
long long query(int l, int r, long long *tree, int mod = -1) {
  if (l > r) return 0;
  long long ans = read(r, tree, mod) - read(l - 1, tree, mod);
  if (mod != -1) ans = (ans + 1000000007) % 1000000007;
  return ans;
}
int a[301009], w[301009];
int main() {
  int n, q, val, l, r, id;
  const int maxi = 200009;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    add(i, w[i], acum, maxi);
    add(i, (i * 1LL * w[i]) % 1000000007, wacum, maxi, 1000000007);
    add(i, (a[i] * 1LL * w[i]) % 1000000007, aw, maxi, 1000000007);
  }
  while (q--) {
    scanf("%d %d", &l, &r);
    if (l < 0) {
      id = -l;
      add(id, -w[id], acum, maxi);
      add(id, (1000000007 - (id * 1LL * w[id]) % 1000000007) % 1000000007,
          wacum, maxi, 1000000007);
      add(id, (1000000007 - (a[id] * 1LL * w[id]) % 1000000007) % 1000000007,
          aw, maxi, 1000000007);
      w[id] = r;
      add(id, w[id], acum, maxi);
      add(id, (id * 1LL * w[id]) % 1000000007, wacum, maxi, 1000000007);
      add(id, (a[id] * 1LL * w[id]) % 1000000007, aw, maxi, 1000000007);
    } else {
      int lo = l, hi = r;
      while (lo < hi) {
        int mid = (lo + hi + 1) / 2;
        long long p1 = query(l, mid - 1, acum);
        long long p2 = query(mid + 1, r, acum);
        if (p1 > p2 + w[mid]) {
          hi = mid - 1;
        } else
          lo = mid;
      }
      id = lo;
      int pos = a[id] - (id - l);
      long long ans = 0;
      ans -= query(l, id - 1, aw, 1000000007);
      ans = (ans + 1000000007) % 1000000007;
      ans += (query(l, id - 1, wacum, 1000000007) -
              l * 1LL * query(l, id - 1, acum, 1000000007)) %
             1000000007;
      ans = (ans + 1000000007) % 1000000007;
      ans += (pos * 1LL * query(l, id - 1, acum, 1000000007)) % 1000000007;
      ans = (ans + 1000000007) % 1000000007;
      ans += query(id + 1, r, aw, 1000000007);
      ans = (ans + 1000000007) % 1000000007;
      ans -= (query(id + 1, r, wacum, 1000000007) -
              (id)*1LL * query(id + 1, r, acum, 1000000007)) %
             1000000007;
      ans = (ans + 1000000007) % 1000000007;
      ans -= (a[id] * 1LL * query(id + 1, r, acum, 1000000007)) % 1000000007;
      ans = (ans + 1000000007) % 1000000007;
      printf("%lld\n", ans);
    }
  }
}
