#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int mod = 1000000007;
const double dancila = 3.14159265359;
const double eps = 1e-9;
int n, q;
int a[200002], w[200002];
struct seg {
  long long sum, costr, costl;
};
seg aint[800002];
void build(int nod, int st, int dr) {
  if (st == dr) {
    aint[nod].sum = w[st];
    if (st != 1) aint[nod].costr = 1LL * w[st] * (a[st] - a[st - 1] - 1);
    if (st != n) aint[nod].costl = 1LL * w[st] * (a[dr + 1] - a[dr] - 1);
    aint[nod].costr %= mod;
    aint[nod].costl %= mod;
    return;
  }
  int mid = (st + dr) / 2;
  build(nod << 1, st, mid);
  build(nod << 1 | 1, mid + 1, dr);
  aint[nod].sum = aint[nod << 1].sum + aint[nod << 1 | 1].sum;
  int lenB = dr - mid;
  int lenA = mid - st + 1;
  if (st != 1) {
    aint[nod].costr = aint[nod << 1].costr + aint[nod << 1 | 1].costr;
    aint[nod].costr += 1LL * (aint[nod << 1 | 1].sum % mod) *
                       ((a[mid] + 1) - (a[st - 1] + lenA) - 1);
  }
  if (dr != n) {
    aint[nod].costl = aint[nod << 1].costl + aint[nod << 1 | 1].costl;
    aint[nod].costl += 1LL * (aint[nod << 1].sum % mod) *
                       ((a[dr + 1] - lenB) - (a[mid + 1] - 1) - 1);
  }
  aint[nod].costr %= mod;
  aint[nod].costl %= mod;
}
void update(int nod, int st, int dr, int poz, int val) {
  if (st == dr) {
    w[st] = val;
    aint[nod].sum = w[st];
    if (st != 1) aint[nod].costr = 1LL * w[st] * (a[st] - a[st - 1] - 1);
    if (dr != n) aint[nod].costl = 1LL * w[st] * (a[dr + 1] - a[dr] - 1);
    aint[nod].sum %= mod;
    aint[nod].costr %= mod;
    aint[nod].costl %= mod;
    return;
  }
  int mid = (st + dr) / 2;
  if (poz <= mid)
    update(nod << 1, st, mid, poz, val);
  else
    update(nod << 1 | 1, mid + 1, dr, poz, val);
  aint[nod].sum = aint[nod << 1].sum + aint[nod << 1 | 1].sum;
  int lenB = dr - mid;
  int lenA = mid - st + 1;
  if (st != 1) {
    aint[nod].costr = aint[nod << 1].costr + aint[nod << 1 | 1].costr;
    aint[nod].costr += 1LL * (aint[nod << 1 | 1].sum % mod) *
                       ((a[mid] + 1) - (a[st - 1] + lenA) - 1);
  }
  if (dr != n) {
    aint[nod].costl = aint[nod << 1].costl + aint[nod << 1 | 1].costl;
    aint[nod].costl += 1LL * (aint[nod << 1].sum % mod) *
                       ((a[dr + 1] - lenB) - (a[mid + 1] - 1) - 1);
  }
  aint[nod].costr %= mod;
  aint[nod].costl %= mod;
}
long long query2(int nod, int st, int dr, int L, int R) {
  if (dr < L || st > R) return 0;
  if (L <= st && dr <= R) return aint[nod].sum;
  int mid = (st + dr) / 2;
  return query2(nod << 1, st, mid, L, R) +
         query2(nod << 1 | 1, mid + 1, dr, L, R);
}
seg query(int nod, int st, int dr, int L, int R) {
  if (L <= st && dr <= R) return aint[nod];
  int mid = (st + dr) / 2;
  seg ans = {0, 0, 0};
  if (mid >= L) {
    seg ans2 = query(nod << 1, st, mid, L, R);
    ans = ans2;
  }
  int lenA = mid - max(st, L) + 1;
  int lenB = min(dr, R) - mid;
  if (mid < R && mid >= L) {
    seg ans2 = query(nod << 1 | 1, mid + 1, dr, L, R);
    ans.costr += ans2.costr;
    ans.costr +=
        (ans2.sum % mod) * ((a[mid] + 1) - (a[max(L - 1, st - 1)] + lenA) - 1);
    ans.costl += ans2.costl;
    ans.costl +=
        (ans.sum % mod) * ((a[min(R, dr) + 1] - lenB) - (a[mid + 1] - 1) - 1);
    ans.costl %= mod;
    ans.costr %= mod;
    ans.sum += ans2.sum;
  } else if (mid < R) {
    seg ans2 = query(nod << 1 | 1, mid + 1, dr, L, R);
    ans = ans2;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> w[i];
  build(1, 1, n);
  for (; q; --q) {
    int poz;
    cin >> poz;
    if (poz < 0) {
      poz = -poz;
      int val;
      cin >> val;
      update(1, 1, n, poz, val);
    } else {
      int xd;
      cin >> xd;
      long long x = query2(1, 1, n, poz, xd);
      int st = poz;
      int dr = xd;
      int ans = -1;
      while (st <= dr) {
        int mid = (st + dr) / 2;
        long long y = query2(1, 1, n, poz, mid);
        if (y * 2 >= x)
          ans = mid, dr = mid - 1;
        else
          st = mid + 1;
      }
      seg y = {0, 0, 0};
      seg z = {0, 0, 0};
      if (ans > poz) y = query(1, 1, n, poz, ans - 1);
      if (ans < xd) z = query(1, 1, n, ans + 1, xd);
      cout << (y.costl + z.costr) % mod << '\n';
    }
  }
  return 0;
}
