#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0LL) return b;
  if (b == 0LL) return a;
  return gcd(b, a % b);
}
const int N = 200005;
int A[N], W[N];
long long pre[N];
pair<long long, long long> tree[N << 2];
void build(int node, int l, int r) {
  if (l == r) {
    tree[node] = make_pair(W[l], A[l] * W[l]);
    return;
  }
  int mid = (l + r) >> 1;
  int left = node << 1;
  int right = left + 1;
  build(left, l, mid);
  build(right, mid + 1, r);
  tree[node].first = tree[left].first + tree[right].first;
  tree[node].second = tree[left].second + tree[right].second;
  return;
}
void update(int node, int l, int r, int idx) {
  if (l == r) {
    tree[node] = make_pair(W[idx], A[idx] * W[idx]);
    return;
  }
  int mid = (l + r) >> 1;
  int left = node << 1;
  int right = left + 1;
  if (idx <= mid)
    update(left, l, mid, idx);
  else
    update(right, mid + 1, r, idx);
  tree[node].first = tree[left].first + tree[right].first;
  tree[node].second = tree[left].second + tree[right].second;
  return;
}
pair<long long, long long> query(int node, int l, int r, int a, int b) {
  if (l == a && r == b) return tree[node];
  int mid = (l + r) >> 1;
  int left = node << 1;
  int right = left + 1;
  if (b <= mid)
    return query(left, l, mid, a, b);
  else if (a > mid)
    return query(right, mid + 1, r, a, b);
  pair<long long, long long> L = query(left, l, mid, a, mid);
  pair<long long, long long> R = query(right, mid + 1, r, mid + 1, b);
  pair<long long, long long> ans =
      make_pair(L.first + R.first, L.second + R.second);
  return ans;
}
long long getAns(int n, int L, int R, int ind) {
  long long X = A[ind];
  long long ans = 0LL;
  pair<long long, long long> val = query(1, 1, n, L, ind);
  ans += X * val.first - val.second;
  val = query(1, 1, n, ind, R);
  ans += val.second - X * val.first;
  return ans;
}
void solve1(int n, int L, int R) {
  int l = L, r = R, mid;
  long long val1, val2;
  while (l < r) {
    mid = (l + r) / 2;
    val1 = getAns(n, L, R, mid);
    val2 = getAns(n, L, R, mid + 1);
    if (val1 < val2)
      r = mid;
    else
      l = mid + 1;
  }
  assert(l == r);
  cout << getAns(n, L, R, l) << "\n";
  return;
}
void solve() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    A[i] = A[i] - i;
    pre[i] = pre[i - 1] + (long long)A[i];
  }
  for (int i = 1; i <= n; i++) cin >> W[i];
  build(1, 1, n);
  int L, R;
  while (q--) {
    cin >> L >> R;
    if (L < 0) {
      L = -1 * L;
      W[L] = R;
      update(1, 1, n, L);
      continue;
    }
    solve1(n, L, R);
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  clock_t clk = clock();
  int t = 1;
  for (int tests = 1; tests <= t; tests++) {
    solve();
  }
  clk = clock() - clk;
  cerr << "Time Elapsed: " << fixed << setprecision(10)
       << ((long double)clk) / CLOCKS_PER_SEC << "\n";
  return 0;
}
