#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
int n, m;
int a[N];
int w[N];
long long t[N];
long long t2[N];
void add(int pos, int val) {
  val %= MOD;
  if (val < 0) val += MOD;
  while (pos <= n) {
    t[pos] += val;
    t[pos] %= MOD;
    pos |= (pos + 1);
  }
}
void add2(int pos, long long val) {
  val %= MOD;
  if (val < 0) val += MOD;
  while (pos <= n) {
    t2[pos] += val;
    t2[pos] %= MOD;
    pos |= (pos + 1);
  }
}
long long get(int pos) {
  long long res = 0;
  while (pos >= 0) {
    res += t[pos];
    res %= MOD;
    pos &= (pos + 1);
    pos--;
  }
  return res;
}
long long get2(int pos) {
  long long res = 0;
  while (pos >= 0) {
    res += t2[pos];
    res %= MOD;
    pos &= (pos + 1);
    pos--;
  }
  return res;
}
long long get(int l, int r) {
  if (l > r) return 0;
  return get(r) - get(l - 1);
}
long long get2(int l, int r) {
  if (l > r) return 0;
  return get2(r) - get2(l - 1);
}
long long solveR(int l, int r, int st) {
  long long sum = 0;
  sum = get2(l, r);
  sum += (l - st) * 1ll * get(l, r);
  sum %= MOD;
  if (sum < 0) sum += MOD;
  return sum;
}
long long solveL(int l, int r, int st) {
  long long sum = 0;
  sum = (st - l) * 1ll * get(l, r);
  sum %= MOD;
  sum -= get2(l, r);
  sum %= MOD;
  if (sum < 0) sum += MOD;
  return sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    add(i, w[i]);
    add2(i, (a[i] - i) * 1ll * w[i]);
  }
  while (m--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      int delta = y - w[x];
      add(x, delta);
      add2(x, -(a[x] - x) * 1ll * w[x]);
      w[x] = y;
      add2(x, (a[x] - x) * 1ll * w[x]);
    } else {
      int low = x - 1, high = y;
      int opt = x - 1;
      while (low <= high) {
        int mid = (low + high) / 2;
        long long sl = get(x, mid);
        long long sr = get(mid + 1, y);
        if (sl <= sr) {
          opt = mid;
          low = mid + 1;
        } else {
          high = mid - 1;
        }
      }
      long long diff = (long long)9e18;
      long long minadd = 0;
      long long ans = -1;
      for (int pos = opt; pos <= opt + 1; pos++) {
        if (pos >= x - 1 && pos <= y) {
          long long sl = get(x, pos);
          long long sr = get(pos + 1, y);
          int cl = pos - x + 1;
          int cr = y - pos;
          int st;
          long long add = 0;
          if (sl <= sr) {
            st = a[pos + 1] - cl;
            if (pos >= x) {
              add = sl % MOD * 1ll * (a[pos + 1] - a[pos] - 1);
              add %= MOD;
            }
          } else {
            st = a[pos] - cl + 1;
            if (pos < y) {
              add = sr % MOD * 1ll * (a[pos + 1] - a[pos] - 1);
              add %= MOD;
            }
          }
          long long res = solveL(x, pos, st) + solveR(pos + 1, y, st + cl);
          res %= MOD;
          res += add;
          res %= MOD;
          if (abs(sl - sr) < diff) {
            ans = res;
            diff = abs(sl - sr);
          }
        }
      }
      cout << ans << endl;
    }
  }
  return 0;
}
