#include <bits/stdc++.h>
using namespace std;
int dir1[8] = {1, 0, 0, -1, -1, 1, -1, 1};
int dir2[8] = {0, -1, 1, 0, -1, 1, 1, -1};
long long MAX = 1e9 + 7;
struct Comp {
  bool operator()(const std::pair<int, pair<int, int>> &a,
                  const std::pair<int, pair<int, int>> &b) {
    if (a.first != b.first) {
      return a.first > b.first;
    }
    return a.second.first < b.second.first;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  long long avail[n + 1], cost[n + 1];
  for (int i = 0; i < n; i++) cin >> avail[i];
  for (int i = 0; i < n; i++) cin >> cost[i];
  priority_queue<pair<long long, pair<long long, long long>>,
                 vector<pair<long long, pair<long long, long long>>>,
                 greater<pair<long long, pair<long long, long long>>>>
      q;
  for (int i = 0; i < n; i++) {
    q.push({cost[i], {i, avail[i]}});
  }
  long long t, g;
  for (int i = 0; i < m; i++) {
    long long ans = 0;
    cin >> t >> g;
    t--;
    if (q.empty()) {
      cout << 0 << "\n";
      continue;
    }
    if (avail[t]) {
      long long rec = min(g, avail[t]);
      avail[t] -= rec;
      g -= rec;
      ans = ans + rec * cost[t];
    }
    while (1) {
      if (q.empty()) break;
      auto temp = q.top();
      if (avail[temp.second.first] == 0) {
        q.pop();
        continue;
      }
      long long rec = min(g, avail[temp.second.first]);
      avail[temp.second.first] -= rec;
      g -= rec;
      ans = ans + rec * cost[temp.second.first];
      if (avail[temp.second.first] == 0) q.pop();
      if (g == 0) break;
      if (q.empty()) break;
    }
    if (g)
      cout << 0 << "\n";
    else
      cout << ans << "\n";
  }
  return 0;
}
