#include <bits/stdc++.h>
using std::lower_bound;
using std::max;
using std::min;
using std::random_shuffle;
using std::reverse;
using std::sort;
using std::swap;
using std::unique;
using std::upper_bound;
using std::vector;
void open(const char *s) {}
void open2(const char *s) {}
int rd() {
  int s = 0, c, b = 0;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-') {
    c = getchar();
    b = 1;
  }
  do {
    s = s * 10 + c - '0';
  } while ((c = getchar()) >= '0' && c <= '9');
  return b ? -s : s;
}
void put(int x) {
  if (!x) {
    putchar('0');
    return;
  }
  static int c[20];
  int t = 0;
  while (x) {
    c[++t] = x % 10;
    x /= 10;
  }
  while (t) putchar(c[t--] + '0');
}
int upmin(int &a, int b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int upmax(int &a, int b) {
  if (b > a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 200010;
int n;
const long long p = 1000000007;
namespace T1 {
long long a[N];
void add(int x, long long v) {
  for (; x <= n; x += x & -x) a[x] += v;
}
long long query(int x) {
  long long s = 0;
  for (; x; x -= x & -x) s += a[x];
  return s;
}
int gao(long long v) {
  int x = 1 << 18;
  for (int i = 17; i >= 0; i--) {
    if (x - (1 << i) >= n)
      x -= 1 << i;
    else if (a[x - (1 << i)] >= v)
      x -= 1 << i;
    else
      v -= a[x - (1 << i)];
  }
  return x;
}
}  // namespace T1
namespace T2 {
long long a[N];
void add(int x, long long v) {
  v %= p;
  for (; x <= n; x += x & -x) (a[x] += v) %= p;
}
long long query(int x) {
  long long s = 0;
  for (; x; x -= x & -x) (s += a[x]) %= p;
  return s;
}
}  // namespace T2
namespace T3 {
long long a[N];
void add(int x, long long v) {
  v %= p;
  for (; x <= n; x += x & -x) (a[x] += v) %= p;
}
long long query(int x) {
  long long s = 0;
  for (; x; x -= x & -x) (s += a[x]) %= p;
  return s;
}
}  // namespace T3
namespace T4 {
long long a[N];
void add(int x, long long v) {
  v %= p;
  for (; x <= n; x += x & -x) (a[x] += v) %= p;
}
long long query(int x) {
  long long s = 0;
  for (; x; x -= x & -x) (s += a[x]) %= p;
  return s;
}
}  // namespace T4
int q;
long long a[N], w[N];
int main() {
  open("c");
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &w[i]);
    T1::add(i, w[i]);
    T2::add(i, w[i] * a[i]);
    T3::add(i, w[i] * i);
    T4::add(i, w[i] * (n - i + 1));
  }
  int l, r;
  for (int i = 1; i <= q; i++) {
    scanf("%d%d", &l, &r);
    if (l < 0) {
      l = -l;
      T1::add(l, r - w[l]);
      T2::add(l, (r - w[l]) * a[l]);
      T3::add(l, (r - w[l]) * l);
      T4::add(l, (r - w[l]) * (n - l + 1));
      w[l] = r;
    } else {
      long long s2 = T1::query(r);
      long long s1 = T1::query(l - 1);
      long long s = s1 + (s2 - s1 + 1) / 2;
      int pos = T1::gao(s);
      long long ans = (a[pos] * (T1::query(pos) - T1::query(l - 1)) % p -
                       (T2::query(pos) - T2::query(l - 1)) +
                       (T2::query(r) - T2::query(pos)) -
                       a[pos] * (T1::query(r) - T1::query(pos))) %
                      p;
      ans -= (T4::query(pos - 1) - T4::query(l - 1)) -
             (T1::query(pos - 1) - T1::query(l - 1)) * (n - (pos - 1) + 1 - 1);
      ans -= (T3::query(r) - T3::query(pos)) -
             (T1::query(r) - T1::query(pos)) * (pos + 1 - 1);
      ans = (ans % p + p) % p;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
