#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, t, d, i;
  cin >> n >> m;
  int a[n], c[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  set<pair<int, int>> s;
  for (i = 0; i < n; i++) {
    cin >> c[i];
    s.insert(make_pair(c[i], i));
  }
  while (m--) {
    long long int cost = 0;
    cin >> t >> d;
    t--;
    while (d > 0) {
      if (s.empty()) break;
      if (a[t] > d) {
        cost += 1LL * d * c[t];
        a[t] -= d;
        d = 0;
      } else if (a[t]) {
        cost += 1LL * a[t] * c[t];
        d -= a[t];
        a[t] = 0;
        s.erase(make_pair(c[t], t));
      } else {
        t = (*(s.begin())).second;
      }
    }
    if (d > 0)
      cout << "0\n";
    else
      cout << cost << "\n";
  }
  return 0;
}
