#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1e18;
const long long INF = 1e9;
const long long MOD = 1000000007;
const long long MAX = 100005;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
#pragma GCC optimize("-fno-defer-pop")
long long strtoll(string second) {
  stringstream str(second);
  long long number = 0;
  str >> number;
  return number;
}
string lltostr(long long n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
bool prime[MAX];
void sieve() {
  memset(prime, true, sizeof(prime));
  prime[0] = prime[1] = false;
  for (long long p = 2; p * p <= MAX; p++) {
    if (prime[p] == true) {
      for (long long i = p * 2; i <= MAX; i += p) prime[i] = false;
    }
  }
}
long long power(long long a, long long b, long long m) {
  if (b == 0) return 1;
  if (b == 1) return a % m;
  long long t = power(a, b / 2, m);
  t = (t * t) % m;
  if (b & 1) t = (t * a) % m;
  return t;
}
long long modInverse(long long a, long long m) { return power(a, m - 2, m); }
long long __gcd(long long a, long long b) {
  if (b == 0) return a;
  return __gcd(b, a % b);
}
bool cmp(const pair<long long, long long> &l,
         const pair<long long, long long> &r) {
  return l.first < r.first;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a[n + 1], c[n + 1];
  for (long long i = 0; i < n; i++) cin >> a[i + 1];
  for (long long i = 0; i < n; i++) cin >> c[i + 1];
  map<long long, long long> mm;
  set<pair<long long, long long> > second;
  for (long long i = 1; i <= n; i++) second.insert({c[i], i});
  for (long long i = 1; i <= n; i++) mm[i] = a[i];
  while (m--) {
    long long ans = 0;
    long long type, q;
    cin >> type >> q;
    if (mm[type] >= q) {
      ans += c[type] * q;
      mm[type] -= q;
    } else {
      ans += mm[type] * c[type];
      q -= mm[type];
      mm[type] = 0;
      while (q && !second.empty()) {
        pair<long long, long long> p = *second.begin();
        long long x = p.first;
        long long y = p.second;
        if (mm[y] >= q) {
          mm[y] -= q;
          ans += (c[y] * q);
          q = 0;
        } else {
          ans += mm[y] * c[y];
          q -= mm[y];
          mm[y] = 0;
          second.erase(second.begin());
        }
      }
      if (q != 0) ans = 0;
    }
    cout << ans << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
