#include <bits/stdc++.h>
using namespace std;
long long int a[100002];
long long int c[100002];
deque<pair<long long int, long long int> > v;
deque<pair<long long int, long long int> >::iterator it;
pair<long long int, long long int> p;
int main() {
  long long int n, m, i, j, x, y;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= n; i++) {
    cin >> c[i];
    v.push_back(make_pair(c[i], i));
  }
  sort(v.begin(), v.end());
  long long int type, dorkar, cost, tp, cst;
  while (m--) {
    cin >> type >> dorkar;
    if (a[type] >= dorkar) {
      cost = c[type] * dorkar;
      a[type] -= dorkar;
      dorkar = 0;
    } else {
      cost = c[type] * a[type];
      dorkar -= a[type];
      a[type] = 0;
      while (dorkar && v.size()) {
        p = v.front();
        tp = p.second;
        cst = p.first;
        if (a[tp] >= dorkar) {
          cost += cst * dorkar;
          a[tp] -= dorkar;
          dorkar = 0;
          break;
        } else {
          cost += cst * a[tp];
          dorkar -= a[tp];
          a[tp] = 0;
          v.pop_front();
          i--;
          if (!dorkar) break;
        }
      }
    }
    if (dorkar) cost = 0;
    cout << cost << endl;
  }
  return 0;
}
