#include <bits/stdc++.h>
int inp() {
  char c = getchar();
  int neg = 1;
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = getchar();
  }
  int sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * neg;
}
struct SEG {
  int l;
  int r;
  long long sum;
  long long ls;
  long long rs;
};
long long s[200010], dis[200010];
SEG operator+(SEG a, SEG b) {
  SEG ret;
  if (a.l == -1) return b;
  if (b.l == -1) return a;
  ret.sum = a.sum + b.sum;
  a.sum %= 1000000007;
  b.sum %= 1000000007;
  ret.ls = a.ls + b.ls + b.sum * (dis[a.r] - dis[a.l - 1]);
  ret.rs = b.rs + a.rs + a.sum * (dis[b.r + 1] - dis[b.l]);
  ret.ls %= 1000000007;
  ret.rs %= 1000000007;
  ret.l = a.l;
  ret.r = b.r;
  return ret;
}
struct SEG_Tree {
  SEG t[800010];
  void push_up(int cur) { t[cur] = t[((cur) << 1)] + t[((cur) << 1 | 1)]; }
  void build(int cur, int l, int r) {
    t[cur].l = l;
    t[cur].r = r;
    if (l == r) {
      t[cur].sum = s[l];
      t[cur].ls = s[l] * (dis[l] - dis[l - 1]);
      t[cur].rs = s[l] * (dis[l + 1] - dis[l]);
      return;
    }
    int mid = (l + r) >> 1;
    build(((cur) << 1), l, mid);
    build(((cur) << 1 | 1), mid + 1, r);
    push_up(cur);
  }
  long long query2(int cur, int l, int r) {
    if (t[cur].l > r || t[cur].r < l) return 0;
    if (t[cur].l >= l && t[cur].r <= r) return t[cur].sum;
    return query2(((cur) << 1), l, r) + query2(((cur) << 1 | 1), l, r);
  }
  SEG query(int cur, int l, int r) {
    if (l > r) return (SEG){0, 0, 0, 0, 0};
    if (t[cur].l > r || t[cur].r < l) return (SEG){-1, -1, -1, -1, -1};
    if (t[cur].l >= l && t[cur].r <= r) return t[cur];
    return query(((cur) << 1), l, r) + query(((cur) << 1 | 1), l, r);
  }
  void modify(int cur, int x, int c) {
    if (t[cur].l == t[cur].r) {
      t[cur].sum = c;
      t[cur].ls = c * (dis[t[cur].l] - dis[t[cur].l - 1]);
      t[cur].rs = c * (dis[t[cur].l + 1] - dis[t[cur].l]);
      return;
    }
    if (x <= t[((cur) << 1)].r)
      modify(((cur) << 1), x, c);
    else
      modify(((cur) << 1 | 1), x, c);
    push_up(cur);
  }
} t;
int solve(int lb, int rb) {
  int l = lb;
  int r = rb;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (t.query2(1, lb, mid) >= t.query2(1, mid + 1, rb))
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int main() {
  int n = inp();
  int q = inp();
  for (int i = 1; i <= n; i++) dis[i] = inp() - i;
  for (int i = 1; i <= n; i++) s[i] = inp();
  t.build(1, 1, n);
  while (q--) {
    int id = inp();
    int c = inp();
    if (id < 0) {
      t.modify(1, -id, c);
    } else {
      int pos = solve(id, c);
      long long ans = 0;
      if (id <= pos - 1) ans += t.query(1, id, pos - 1).rs;
      if (pos + 1 <= c) ans += t.query(1, pos + 1, c).ls;
      ans %= 1000000007;
      printf("%I64d\n", ans);
    }
  }
}
