#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long n, m, f, t, d, val;
vector<long long> a, c;
set<pair<long long, long long> > s;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  cin >> n >> m;
  a.resize(n);
  c.resize(n);
  for (auto& i : a) cin >> i;
  for (auto& i : c) cin >> i;
  for (int i = 0; i < n; i++) s.insert(make_pair(c[i], i));
  while (m--) {
    cin >> t >> d;
    t--;
    long long bill = 0;
    val = min(a[t], d);
    bill += val * c[t];
    a[t] -= val;
    d -= val;
    while (d) {
      if (s.empty()) break;
      val = min(a[s.begin()->second], d);
      bill += val * (s.begin()->first);
      a[s.begin()->second] -= val;
      d -= val;
      if (a[s.begin()->second] == 0) s.erase(s.begin());
    }
    if (d)
      cout << "0\n";
    else
      cout << bill << "\n";
  }
}
