#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, m;
  cin >> n >> m;
  long long int re[n], cost[n], tot = 0;
  pair<long long int, long long int> p[n];
  for (long long int i = 0; i < n; i++) {
    cin >> re[i];
    tot += re[i];
  }
  for (long long int i = 0; i < n; i++) {
    cin >> cost[i];
    p[i].first = cost[i];
    p[i].second = i;
  }
  sort(p, p + n);
  long long int k = 0;
  for (long long int i = 0; i < m; i++) {
    long long int a, b;
    cin >> a >> b;
    a--;
    long long int ans = 0;
    if (b > tot) {
      tot -= b;
      cout << ans << endl;
    } else {
      tot -= b;
      if (b <= re[a]) {
        ans += b * cost[a];
        re[a] -= b;
      } else {
        ans += re[a] * cost[a];
        b -= re[a];
        re[a] = 0;
        while (b > 0) {
          if (b <= re[p[k].second]) {
            ans += b * p[k].first;
            re[p[k].second] -= b;
            b = 0;
          } else {
            ans += (re[p[k].second]) * (p[k].first);
            b -= re[p[k].second];
            re[p[k].second] = 0;
            k++;
          }
        }
      }
      cout << ans << endl;
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
