#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m, t, d;
  cin >> n >> m;
  priority_queue<pair<long long int, long long int>,
                 vector<pair<long long int, long long int>>,
                 greater<pair<long long int, long long int>>>
      pq;
  long long int A[n + 1], C[n + 1];
  for (long long int i = 1; i <= n; i++) {
    cin >> A[i];
  }
  for (long long int i = 1; i <= n; i++) {
    cin >> C[i];
    pq.push(make_pair(C[i], i));
  }
  for (long long int i = 1; i <= m; i++) {
    cin >> t >> d;
    if (A[t] >= d) {
      cout << (d * C[t]) << endl;
      A[t] -= d;
    } else {
      bool flag = false;
      long long int ans = A[t] * C[t];
      d -= A[t];
      A[t] = 0;
      while (!pq.empty()) {
        while (!pq.empty() && A[pq.top().second] == 0) pq.pop();
        if (pq.empty()) break;
        auto h = pq.top();
        if (d <= A[h.second]) {
          A[h.second] -= d;
          ans += (d * h.first);
          flag = true;
          cout << ans << "\n";
          break;
        } else {
          ans += (A[h.second] * h.first);
          d -= A[h.second];
          A[h.second] = 0;
          pq.pop();
        }
      }
      if (flag == false) cout << 0 << "\n";
    }
  }
}
