#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
signed main() {
  ios::sync_with_stdio(false);
  cout.precision(17);
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n), c(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  for (long long i = 0; i < (n); i++) cin >> c[i];
  set<pair<long long, long long>> q;
  for (long long i = 0; i < (n); i++) {
    q.insert({c[i], i});
  }
  for (long long i = 0; i < (m); i++) {
    long long t, d;
    long long cost = 0;
    cin >> t >> d;
    t--;
    long long cnt = min(a[t], d);
    a[t] -= cnt;
    d -= cnt;
    cost += cnt * c[t];
    while (d > 0 and !q.empty()) {
      auto v = q.begin()->second;
      cnt = min(a[v], d);
      a[v] -= cnt;
      d -= cnt;
      cost += cnt * c[v];
      if (a[v] == 0) q.erase(q.begin());
    }
    if (d == 0)
      cout << cost << "\n";
    else
      cout << "0\n";
  }
  cout << endl;
  ;
  return 0;
}
