#include <bits/stdc++.h>
using namespace std;
bool compareFood(pair<long long int, int> const& p1,
                 pair<long long int, int> const& p2) {
  return (p1.first < p2.first) ||
         ((p1.first == p2.first) && (p1.second < p2.second));
}
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  pair<long long int, int> c[n];
  long long int costs[n];
  for (int i = 0; i < n; i++) {
    cin >> costs[i];
    c[i].first = costs[i];
    c[i].second = i;
  }
  sort(c, c + n, compareFood);
  int cheapest = 0;
  while (m--) {
    int t;
    long long int d;
    cin >> t >> d;
    long long int cost = 0LL;
    bool satisfied = true;
    if (a[t - 1] >= d) {
      a[t - 1] -= d;
      cost += d * costs[t - 1];
    } else {
      cost += a[t - 1] * costs[t - 1];
      d -= a[t - 1];
      a[t - 1] = 0;
      while (d > 0) {
        if (cheapest == n) {
          satisfied = false;
          break;
        } else if (a[c[cheapest].second] > d) {
          cost += d * c[cheapest].first;
          a[c[cheapest].second] -= d;
          d = 0;
        } else {
          cost += a[c[cheapest].second] * c[cheapest].first;
          d -= a[c[cheapest].second];
          a[c[cheapest].second] = 0;
          cheapest += 1;
        }
      }
    }
    if (satisfied)
      cout << cost << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
