#include <bits/stdc++.h>
using namespace std;
const long long int mod = (long long int)(998244353);
long long int test = 1;
vector<long long int> read(int n) {
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  return v;
}
void solve() {
  long long int i, j, k, m, n, cnt = 0, ans = 0, sum = 0;
  cin >> n >> m;
  std::vector<long long int> a = read(n);
  std::vector<long long int> c = read(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>>>
      pq;
  for (long long int i = 0; i <= n - 1; i++) {
    pq.push({c[i], i});
  }
  while (m--) {
    long long int t, d;
    cin >> t >> d;
    t--;
    ans = 0;
    if (d <= a[t]) {
      a[t] -= d;
      cout << c[t] * d << "\n";
      d = 0;
    } else {
      ans = c[t] * a[t];
      d -= a[t];
      a[t] = 0;
      bool done = false;
      while (d > 0 && !pq.empty()) {
        long long int small = pq.top().first;
        long long int idx = pq.top().second;
        pq.pop();
        if (a[idx] >= d) {
          a[idx] -= d;
          ans += d * c[idx];
          if (a[idx] > 0) {
            pq.push({c[idx], idx});
          }
          d = 0;
        } else {
          ans += a[idx] * c[idx];
          d -= a[idx];
          a[idx] = 0;
        }
      }
      if (d == 0) done = 1;
      if (done) {
        cout << ans << "\n";
      } else {
        cout << 0 << "\n";
      }
    }
  }
  test++;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int i = 1;
  solve();
  return 0;
}
