#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 1;
const int MAX_M = 1e5 + 1;
long long int n, m, cost;
long long int ingre[MAX_N], dish[MAX_N];
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> > >
    plot;
void input() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> ingre[i];
  for (int i = 1; i <= n; i++) cin >> dish[i];
}
int main() {
  input();
  for (int i = 1; i <= n; i++) {
    pair<long long int, long long int> p;
    p.first = dish[i], p.second = i;
    plot.push(p);
  }
  while (m--) {
    long long int t, d, ans = 0;
    cin >> t >> d;
    while (d) {
      if (ingre[t] > 0) {
        if (ingre[t] >= d) {
          ingre[t] -= d;
          ans += dish[t] * d;
          d = 0;
        } else if (ingre[t] > 0) {
          ans += dish[t] * ingre[t];
          d -= ingre[t];
          ingre[t] = 0;
        } else
          continue;
      } else {
        if (plot.empty()) {
          ans = 0;
          break;
        }
        pair<long long int, long long int> p = plot.top();
        int id = p.second, value = p.first;
        if (ingre[id] == 0) {
          plot.pop();
          continue;
        }
        if (ingre[id] >= d) {
          ingre[id] -= d;
          ans += dish[id] * d;
          d = 0;
        } else {
          ans += dish[id] * ingre[id];
          d -= ingre[id];
          ingre[id] = 0;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
