#include <bits/stdc++.h>
using namespace std;
void solve() {
  unsigned long long n, m, x, y, t, index;
  cin >> n >> m;
  unsigned long long j = 0;
  vector<unsigned long long> no(n), cost(n);
  vector<pair<unsigned long long, unsigned long long> > v;
  for (unsigned long long i = 0; i < n; i++) cin >> no[i];
  for (unsigned long long i = 0; i < n; i++) cin >> cost[i];
  for (unsigned long long i = 0; i < n; i++) {
    v.push_back({cost[i], i});
  }
  sort((v).begin(), (v).end());
  for (unsigned long long i = 0; i < m; i++) {
    cin >> x >> y;
    if (y <= no[x - 1]) {
      no[x - 1] -= y;
      cout << y * cost[x - 1] << '\n';
      continue;
    } else {
      unsigned long long ans = 0;
      ans += no[x - 1] * cost[x - 1];
      y -= no[x - 1];
      no[x - 1] = 0;
      while (y && j < n) {
        index = v[j].second;
        if (no[index] > 0) {
          t = min(no[index], y);
          ans += (t * cost[index]);
          no[index] -= t;
          y -= t;
        } else
          j++;
      }
      if (y > 0) ans = 0;
      cout << ans << '\n';
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  unsigned long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
