#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<long long int, long long int> p1,
         pair<long long int, long long int> p2) {
  if (p1.first != p2.first)
    return p1.first < p2.first;
  else
    return p1.second < p2.second;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int a[n], c[n];
  vector<pair<long long int, long long int> > co;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) {
    cin >> c[i];
    co.push_back(make_pair(c[i], i));
  }
  sort(co.begin(), co.end());
  pair<long long int, long long int> ord[m];
  for (long long int i = 0; i < m; i++) {
    long long int a, b;
    cin >> a >> b;
    ord[i] = make_pair(a - 1, b);
  }
  long long int k = 0;
  for (long long int i = 0; i < m; i++) {
    long long int cost = 0;
    long long int tj = ord[i].first;
    long long int dj = ord[i].second;
    if (a[tj] < dj) {
      cost += a[tj] * c[tj];
      dj -= a[tj];
      a[tj] = 0;
      for (long long int j = k; j < n && dj > 0; j++) {
        if (a[co[j].second] < dj) {
          cost += a[co[j].second] * c[co[j].second];
          dj -= a[co[j].second];
          a[co[j].second] = 0;
          k++;
        } else {
          cost += dj * c[co[j].second];
          a[co[j].second] -= dj;
          dj = 0;
        }
      }
    } else {
      cost += c[tj] * dj;
      a[tj] -= dj;
      dj = 0;
    }
    if (dj == 0)
      cout << cost << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
