#include <bits/stdc++.h>
using namespace std;
int remaining[100005] = {0};
int cost[100005] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      q;
  for (int i = 1; i <= n; i++) {
    cin >> remaining[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> cost[i];
    q.push(make_pair(cost[i], i));
  }
  for (int i = 0; i < m; i++) {
    int t, d;
    cin >> t >> d;
    if (d <= remaining[t]) {
      long long ans = 1LL * d * cost[t];
      remaining[t] -= d;
      cout << ans << "\n";
    } else {
      bool served = false;
      long long ans = 1LL * remaining[t] * cost[t];
      d -= remaining[t];
      remaining[t] = 0;
      while (q.empty() == false) {
        while (q.empty() == false && remaining[q.top().second] == 0) {
          q.pop();
        }
        if (q.empty() == true) {
          break;
        }
        pair<int, int> x = q.top();
        if (d <= remaining[x.second]) {
          ans += 1LL * d * x.first;
          remaining[x.second] -= d;
          served = true;
          cout << ans << "\n";
          break;
        } else {
          ans += 1LL * remaining[x.second] * x.first;
          d -= remaining[x.second];
          remaining[x.second] = 0;
          q.pop();
        }
      }
      if (served == false) {
        cout << 0 << '\n';
      }
    }
  }
  return 0;
}
