#include <bits/stdc++.h>
using namespace std;
int a[100005], c[100005];
set<pair<int, int> > st;
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i <= n; i++) st.insert(make_pair(c[i], i));
  for (int i = 0; i < m; i++) {
    int t, d;
    cin >> t >> d;
    long long cost = 0;
    while (d) {
      if (a[t]) {
        int s = min(a[t], d);
        d -= s;
        a[t] -= s;
        if (!a[t]) st.erase(make_pair(c[t], t));
        cost += 1LL * s * c[t];
      } else {
        if (st.empty()) {
          cost = 0;
          break;
        } else {
          pair<int, int> x = *st.begin();
          t = x.second;
          int s = min(a[t], d);
          d -= s;
          a[t] -= s;
          if (!a[t]) st.erase(make_pair(c[t], t));
          cost += 1LL * s * c[t];
        }
      }
    }
    cout << cost << endl;
  }
  return 0;
}
