#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[n], c[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq;
  for (int i = 0; i < n; i++) {
    if (a[i] > 0) pq.push({c[i], i});
  }
  while (m--) {
    long long cost = 0;
    long long t, d;
    cin >> t >> d;
    t--;
    if (a[t] >= d) {
      cost += (c[t] * d);
      a[t] -= d;
      cout << cost << endl;
    } else {
      cost += (c[t] * a[t]);
      d -= a[t];
      a[t] = 0;
      while (!pq.empty()) {
        if (d == 0) break;
        pair<long long, long long> x = pq.top();
        pq.pop();
        if (d >= a[x.second]) {
          d -= a[x.second];
          cost += (x.first * a[x.second]);
          a[x.second] = 0;
        } else {
          a[x.second] -= d;
          cost += (x.first * d);
          d = 0;
          pq.push(x);
        }
      }
      if (d != 0)
        cout << "0" << endl;
      else
        cout << cost << endl;
    }
  }
}
