#include <bits/stdc++.h>
using ul = std::uint32_t;
using ull = std::uint64_t;
using li = std::int32_t;
using ll = std::int64_t;
using vull = std::vector<ull>;
using vul = std::vector<ul>;
const ul sz = 1 << 18;
const ul base = 1e9 + 7;
class ulll {
 public:
  ul x0 = 0;
  ul x1 = 0;
  ul x2 = 0;
  ul x3 = 0;
  ulll() = default;
  ulll(ul x) : x0(x) {}
  ulll(ull x) : x0(x % base), x1(x / base) {}
  ul& operator[](ul i) { return (i & 1) ? x1 : ((i & 2) ? x2 : x0); }
  ul operator[](ul i) const { return (i & 1) ? x1 : ((i & 2) ? x2 : x0); }
};
using vulll = std::vector<ulll>;
bool operator<(const ulll& a, const ulll& b) {
  for (ul i = 2; i; --i) {
    if (a[i] != b[i]) {
      return a[i] < b[i];
    }
  }
  return a[0] < b[0];
}
ulll& operator+=(ulll& a, const ulll& b) {
  ul c = 0;
  for (ul i = 0; i != 3; ++i) {
    a[i] += b[i] + c;
    if (a[i] >= base) {
      c = 1;
      a[i] -= base;
    } else {
      c = 0;
    }
  }
  return a;
}
ulll operator+(const ulll& a, const ulll& b) {
  ulll ret = a;
  return ret += b;
}
ulll& operator-=(ulll& a, const ulll& b) {
  if (a < b) {
    return a = ul(0);
  }
  ul c = 0;
  for (ul i = 0; i != 3; ++i) {
    if (a[i] < b[i] + c) {
      a[i] += base - b[i] - c;
      c = 1;
    } else {
      a[i] -= b[i] + c;
      c = 0;
    }
  }
  return a;
}
ulll operator-(const ulll& a, const ulll& b) {
  ulll ret = a;
  return ret -= b;
}
ulll& operator*=(ulll& a, ul b) {
  for (ul i = 2; ~i; --i) {
    ull temp = ull(a[i]) * b;
    a[i] = 0;
    for (ul j = i; j != 3 && temp; ++j) {
      a[j] += temp % base;
      temp /= base;
      if (a[j] >= base) {
        ++temp;
        a[j] -= base;
      }
    }
  }
  return a;
}
ulll operator*(const ulll& a, ul b) {
  ulll ret = a;
  return ret *= b;
}
void change(ul pos, const ulll& v, vulll& tree) {
  for (tree[pos |= sz] = v, pos >>= 1; pos; pos >>= 1) {
    tree[pos] = tree[pos << 1] + tree[pos << 1 | 1];
  }
}
ulll query(ul l, ul r, const vulll& tree) {
  ulll ret;
  for (l = l - 1 | sz, r = r + 1 | sz; l ^ r ^ 1; l >>= 1, r >>= 1) {
    if (~l & 1) {
      ret += tree[l ^ 1];
    }
    if (r & 1) {
      ret += tree[r ^ 1];
    }
  }
  return ret;
}
vulll atree(sz << 1, ul(0));
vulll tree(sz << 1, ul(0));
ul n, q;
vul a(2e5 + 1);
ulll compute(ul l, ul r, ul cut) {
  return query(l, cut - 1, tree) * a[cut] - query(l, cut - 1, atree) +
         query(cut + 1, r, atree) - query(cut + 1, r, tree) * a[cut];
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cin >> n >> q;
  for (ul i = 1; i <= n; ++i) {
    std::cin >> a[i];
    a[i] -= i;
  }
  for (ul i = 1; i <= n; ++i) {
    ul w;
    std::cin >> w;
    change(i, w, tree);
    change(i, ull(a[i]) * ull(w), atree);
  }
  for (ul i = 0; i != q; ++i) {
    li x, y;
    std::cin >> x >> y;
    if (x < 0) {
      ul id = -x;
      ul w = y;
      change(id, w, tree);
      change(id, ull(a[id]) * ull(w), atree);
    } else {
      ul l = x, r = y;
      ul lans = l, rans = r;
      while (lans != rans) {
        ul midl = lans + rans >> 1;
        ul midr = midl + 1;
        if (compute(l, r, midl) < compute(l, r, midr)) {
          rans = midr - 1;
        } else {
          lans = midl + 1;
        }
      }
      std::cout << compute(l, r, lans)[0] << std::endl;
    }
  }
  return 0;
}
