#include <bits/stdc++.h>
using namespace std;
vector<int> a, c;
set<pair<int, int> > s;
int n, m;
int main() {
  cin >> n >> m;
  a.resize(n);
  c.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    s.insert(make_pair(c[i], i));
  }
  for (int i = 0; i < m; ++i) {
    int t = 0, d = 0;
    long long tot = 0;
    cin >> t >> d;
    t--;
    while (d > 0 && s.size() > 0) {
      if (a[t] > 0) {
        int m = min(a[t], d);
        tot += (long long)m * (long long)c[t];
        a[t] -= m;
        d -= m;
        if (a[t] == 0) s.erase(make_pair(c[t], t));
      } else {
        int ind = s.begin()->second;
        int m = min(a[ind], d);
        tot += (long long)m * (long long)c[ind];
        a[ind] -= m;
        d -= m;
        if (a[ind] == 0) s.erase(make_pair(c[ind], ind));
      }
    }
    if (d > 0) tot = 0;
    cout << tot << endl;
  }
  return 0;
}
