#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int add(int x, int y) { return ((x + y) % mod + mod) % mod; }
int mul(int x, int y) { return (long long)x * y % mod; }
int mypow(int x, int c) {
  int ret = 1;
  while (c > 0) {
    if (c & 1) {
      ret = mul(ret, x);
    }
    c /= 2;
    x = mul(x, x);
  }
  return ret;
}
long long pen[200005];
void update(int ind, int add) {
  while (ind < 200005) {
    pen[ind] += add;
    ind += ind & (-ind);
  }
}
long long query(int ind) {
  long long ret = 0;
  while (ind > 0) {
    ret = ret + pen[ind];
    ind = ind & (ind - 1);
  }
  return ret;
}
int a[200005], w[200005];
int pen2[200005];
int pen3[200005];
void update2(int *pp, int ind, int ad) {
  while (ind < 200005) {
    pp[ind] = add(pp[ind], ad);
    ind += ind & (-ind);
  }
}
int query2(int *pp, int ind) {
  int ret = 0;
  while (ind > 0) {
    ret = add(ret, pp[ind]);
    ind = ind & (ind - 1);
  }
  return ret;
}
int getS(int x, int y, int wei) {
  long long s = query(y) - query(x - 1);
  int sum = s % mod;
  int r = add(add(query2(pen3, y), -query2(pen3, x - 1)), -mul(sum, x));
  return add(r, mul(sum, wei));
}
void solve() {
  int n, q;
  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]);
    update(i, w[i]);
    update2(pen2, i, mul(w[i], a[i]));
    update2(pen3, i, mul(i, w[i]));
  }
  while (q--) {
    int x, y;
    scanf("%d %d ", &x, &y);
    if (x < 0) {
      int id = -x;
      update(id, -w[id]);
      update2(pen2, id, -mul(w[id], a[id]));
      update2(pen3, id, -mul(id, w[id]));
      w[id] = y;
      update(id, w[id]);
      update2(pen2, id, mul(w[id], a[id]));
      update2(pen3, id, mul(id, w[id]));
    } else {
      long long pre = query(x - 1);
      long long sum = query(y) - pre;
      int l = x, r = y, mid;
      while (l < r) {
        mid = (l + r) / 2;
        if ((query(mid) - pre) * 2 > sum) {
          r = mid;
        } else {
          l = mid + 1;
        }
      }
      int ind = l;
      int ret = 0;
      if (x <= ind - 1) {
        int wei = a[ind] - ind + x;
        ret = add(ret, add(getS(x, ind - 1, wei),
                           -add(query2(pen2, ind - 1), -query2(pen2, x - 1))));
      }
      if (ind + 1 <= y) {
        int wei = a[ind] + 1;
        ret = add(ret, add(-getS(ind + 1, y, wei),
                           add(query2(pen2, y), -query2(pen2, ind))));
      }
      printf("%d\n", ret);
    }
  }
}
int main() {
  solve();
  return 0;
}
