#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 1000000007) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
struct fw1 {
  long long b[200105];
  void update(int x, long long val) {
    for (int i = x; i <= n; i += i & -i) {
      b[i] += val;
    }
  }
  long long query(int x) {
    long long ret = 0;
    for (; x > 0; ret += b[x], x -= x & -x)
      ;
    return ret;
  }
  long long qy(int l, int r) {
    if (r < l) return 0;
    return query(r) - query(l - 1);
  }
} pw;
struct fw {
  int b[200105];
  void update(int x, int val) {
    for (int i = x; i <= n; i += i & -i) {
      addmod(b[i], val);
    }
  }
  int query(int x) {
    int ret = 0;
    for (; x > 0; addmod(ret, b[x]), x -= x & -x)
      ;
    return ret;
  }
  int qy(int l, int r) {
    if (r < l) return 0;
    return (query(r) - query(l - 1) + 1000000007) % 1000000007;
  }
} pwa;
int a[200105], w[200105], aw[200105];
void upt(int id, int nw) {
  pw.update(id, nw - w[id]);
  w[id] = nw;
  int naw = (long long)a[id] * nw % 1000000007;
  pwa.update(id, (naw + 1000000007 - aw[id]) % 1000000007);
  aw[id] = naw;
}
int cal(int l, int r) {
  if (l == r) return 0;
  long long S = pw.qy(l, r);
  int L = l, R = r;
  while (L + 1 < R) {
    int mid = (L + R) / 2;
    long long z = pw.qy(l, mid);
    if (z + z < S)
      L = mid + 1;
    else
      R = mid;
  }
  long long z = pw.qy(l, L);
  int pos;
  if (z + z < S)
    pos = R;
  else
    pos = L;
  int ans = pw.qy(l, pos - 1) % 1000000007 * a[pos] % 1000000007;
  addmod(ans, 1000000007 - pwa.qy(l, pos - 1));
  addmod(ans, pwa.qy(pos + 1, r));
  addmod(ans,
         1000000007 - pw.qy(pos + 1, r) % 1000000007 * a[pos] % 1000000007);
  return ans;
}
void fmain(int ID) {
  scanf("%d%d", &n, &m);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", a + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", w + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) pw.update(i, w[i]);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    addmod(a[i], 1000000007 - i);
    aw[i] = (long long)a[i] * w[i] % 1000000007;
    pwa.update(i, aw[i]);
  }
  for (int(i) = 1; (i) <= (int)(m); (i)++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      upt(-x, y);
    } else {
      printf("%d\n", cal(x, y));
    }
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
