#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long x[n + 5];
  long long y[n + 5];
  for (long long i = 1; i <= n; i++) {
    cin >> x[i];
  }
  deque<pair<long long, long long>> z;
  for (long long i = 1; i <= n; i++) {
    cin >> y[i];
    z.push_back(make_pair(y[i], i));
  }
  sort(z.begin(), z.end());
  long long t = 0;
  for (long long i = 0; i < m; i++) {
    long long d, e;
    cin >> d >> e;
    long long sum = 0;
    if (x[d] >= e) {
      x[d] = x[d] - e;
      sum += (e * y[d]);
      e = 0;
    } else {
      sum += (x[d] * y[d]);
      e = e - x[d];
      x[d] = 0;
      for (long long k = t; k < z.size(); k++) {
        if (e >= x[z[k].second]) {
          e = e - x[z[k].second];
          sum = sum + (z[k].first * x[z[k].second]);
          x[z[k].second] = 0;
          t++;
        } else {
          sum += (e * z[k].first);
          x[z[k].second] = x[z[k].second] - e;
          e = 0;
          break;
        }
      }
    }
    if (e > 0) {
      cout << "0" << endl;
    } else {
      cout << sum << endl;
    }
  }
}
