#include <bits/stdc++.h>
using namespace std;
struct kind {
  int r, c, id;
  kind() {}
  kind(int r, int c, int id) : r(r), c(c), id(id) {}
  bool const operator<(const kind &o) const {
    if (c < o.c) return true;
    if (c == o.c) return id < o.id;
    return false;
  }
};
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> remain(n), cost(n);
  for (int i = 0; i < n; i++) scanf("%d", &remain[i]);
  for (int i = 0; i < n; i++) scanf("%d", &cost[i]);
  set<kind> st;
  for (int i = 0; i < n; i++) st.insert(kind(remain[i], cost[i], i));
  while (m--) {
    int t, d;
    scanf("%d%d", &t, &d);
    t--;
    if (st.empty()) {
      puts("0");
      continue;
    }
    long long ans = 0;
    if (remain[t] > d) {
      ans += 1LL * d * cost[t];
      st.erase(kind(remain[t], cost[t], t));
      remain[t] -= d;
      st.insert(kind(remain[t], cost[t], t));
    } else {
      ans += 1LL * remain[t] * cost[t];
      d -= remain[t];
      st.erase(kind(remain[t], cost[t], t));
      remain[t] = 0;
      while (d) {
        if (st.empty()) {
          ans = 0;
          break;
        }
        auto at = *st.begin();
        st.erase(st.begin());
        if (at.r > d) {
          ans += 1LL * at.c * d;
          at.r -= d;
          ;
          remain[at.id] = at.r;
          d = 0;
          if (at.r > 0) st.insert(at);
        } else {
          ans += 1LL * at.c * at.r;
          remain[at.id] = 0;
          d -= at.r;
        }
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
