#include <bits/stdc++.h>
using namespace std;
struct Node {
  long long xL, xR, sum, costTL, costTR;
  Node() { xL = xR = sum = costTL = costTR = 0; }
  Node(long long x, long long w) {
    xL = xR = x;
    sum = w;
    costTL = costTR = 0;
  }
  void updateN(long long w) { sum = w; }
};
const int MOD = 1e9 + 7;
Node join(Node p1, Node p2) {
  Node r;
  r.xL = p1.xL, r.xR = p2.xR;
  r.sum = p1.sum + p2.sum;
  r.costTL = p1.costTL + p2.costTL + ((p2.xL - p1.xL) % MOD) * (p2.sum % MOD);
  r.costTL %= MOD;
  r.costTR = p1.costTR + p2.costTR + ((p2.xR - p1.xR) % MOD) * (p1.sum % MOD);
  r.costTR %= MOD;
  return r;
}
int N;
int A[200010], W[200010];
Node st[800010];
void create(int n = 1, int l = 0, int r = N) {
  if (l == r)
    st[n] = Node(A[l], W[l]);
  else {
    int m = (l + r) / 2;
    create(2 * n, l, m);
    create(2 * n + 1, m + 1, r);
    st[n] = join(st[2 * n], st[2 * n + 1]);
  }
}
Node query(int x, int y, int n = 1, int l = 0, int r = N) {
  if (x <= l && r <= y)
    return st[n];
  else {
    int m = (l + r) / 2;
    if (y <= m) return query(x, y, 2 * n, l, m);
    if (x > m) return query(x, y, 2 * n + 1, m + 1, r);
    return join(query(x, y, 2 * n, l, m), query(x, y, 2 * n + 1, m + 1, r));
  }
}
void update(int x, int v, int n = 1, int l = 0, int r = N) {
  if (l == r)
    st[n].updateN(v);
  else {
    int m = (l + r) / 2;
    if (x <= m)
      update(x, v, 2 * n, l, m);
    else
      update(x, v, 2 * n + 1, m + 1, r);
    st[n] = join(st[2 * n], st[2 * n + 1]);
  }
}
int getMid(long long v, int n = 1, int l = 0, int r = N) {
  if (l == r) return l;
  int m = (l + r) / 2;
  if (st[2 * n].sum < v) {
    v -= st[2 * n].sum;
    return getMid(v, 2 * n + 1, m + 1, r);
  }
  return getMid(v, 2 * n, l, m);
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  for (int i = 0; i < n; i++) scanf("%d", &W[i]);
  N = n - 1;
  create();
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0)
      update(-x - 1, y);
    else {
      x--, y--;
      if (x == y) {
        puts("0");
        continue;
      }
      long long ms = query(x, y).sum / 2;
      if (x) ms += query(0, x - 1).sum;
      int m = getMid(ms + 1);
      if (m == x) m++;
      if (m > y) m = y;
      Node t1 = query(x, m - 1), t2 = query(m, y);
      long long ans = t1.costTR + t2.costTL;
      ans += ((t2.xL - t1.xR) % MOD) * (min(t1.sum, t2.sum) % MOD);
      ans %= MOD;
      printf("%I64d\n", ans);
    }
  }
}
