#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 9, mod = 1e9 + 7, inf = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq;
  long long n, m;
  cin >> n >> m;
  long long rem[n + 3], cost[n + 5];
  for (int i = 1; i <= n; i++) cin >> rem[i];
  for (int i = 1; i <= n; i++) {
    cin >> cost[i];
    pq.push({cost[i], i});
  }
  while (m--) {
    long long tj, lj;
    cin >> tj >> lj;
    if (rem[tj] >= lj) {
      cout << (lj * cost[tj]) << "\n";
      rem[tj] -= lj;
    } else {
      long long r = rem[tj] * cost[tj];
      lj -= rem[tj];
      rem[tj] = 0;
      while (!pq.empty() && lj > 0) {
        if (rem[pq.top().second] > lj) {
          r += (lj * cost[pq.top().second]);
          rem[pq.top().second] -= lj;
          lj = 0;
        } else {
          r += (rem[pq.top().second] * cost[pq.top().second]);
          lj -= rem[pq.top().second];
          rem[pq.top().second] = 0;
          pq.pop();
        }
      }
      if (lj > 0) r = 0;
      cout << r << "\n";
    }
  }
  return 0;
}
