#include <bits/stdc++.h>
using namespace std;
int n, q, a[200005], w[200005], t1[200005];
long long t[200005];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = (x + (x << 2) << 1) + (ch ^ 48);
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 ^ 48);
}
void add(int x, int y) {
  while (x <= n) t[x] += y, x += x & -x;
}
long long query(int x) {
  long long ans = 0;
  while (x) ans += t[x], x &= x - 1;
  return ans;
}
void Add(int x, int y) {
  while (x <= n) t1[x] = (t1[x] + y) % 1000000007, x += x & -x;
}
int Query(int x) {
  int ans = 0;
  while (x) ans = (ans + t1[x]) % 1000000007, x &= x - 1;
  return ans;
}
int main() {
  n = read(), q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++)
    w[i] = read(), add(i, w[i]),
    Add(i, (long long)w[i] * (a[i] - i) % 1000000007);
  while (q--) {
    int x = read(), y = read();
    if (x > 0) {
      int l = x, r = y;
      long long b = query(l - 1), c = query(r);
      while (l < r) {
        int mid = l + r >> 1;
        long long d = query(mid);
        if (d - b < c - d)
          l = mid + 1;
        else
          r = mid;
      }
      write((((query(l) - b) % 1000000007 * (a[l] - l) - Query(l) +
              Query(x - 1) + (c - query(l - 1)) % 1000000007 * (l - a[l]) +
              Query(y) - Query(l - 1)) %
                 1000000007 +
             1000000007) %
            1000000007),
          putchar('\n');
    } else
      add(-x, y - w[-x]),
          Add(-x, (long long)(y - w[-x]) * (a[-x] + x) % 1000000007), w[-x] = y;
  }
  return 0;
}
