#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int maxn1 = 1e5 + 7;
long long a[maxn1], c[maxn1];
int main() {
  ios::sync_with_stdio(0);
  int n, m, t, d;
  cin >> n >> m;
  set<int> s1;
  set<pair<int, int> > s2;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s1.insert(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    s2.insert(make_pair(c[i], i));
  }
  set<pair<int, int> >::iterator it;
  pair<int, int> tmp;
  while (m--) {
    cin >> t >> d;
    long long res = 0;
    if (s1.count(t)) {
      if (a[t] >= d) {
        res += d * c[t];
        a[t] -= d;
        d = 0;
        if (a[t] == 0) {
          s1.erase(t);
          s2.erase(make_pair(c[t], t));
        }
        cout << res << endl;
        continue;
      }
      res += a[t] * c[t];
      d -= a[t];
      a[t] = 0;
      s1.erase(t);
      s2.erase(make_pair(c[t], t));
    }
    while (d > 0) {
      if (s1.size() == 0) {
        res = 0;
        break;
      }
      it = s2.begin();
      tmp = *it;
      if (a[tmp.second] >= d) {
        res += d * c[tmp.second];
        a[tmp.second] -= d;
        d = 0;
        if (a[tmp.second] == 0) {
          s1.erase(tmp.second);
          s2.erase(make_pair(c[tmp.second], tmp.second));
        }
      } else {
        res += a[tmp.second] * c[tmp.second];
        d -= a[tmp.second];
        a[tmp.second] = 0;
        s1.erase(tmp.second);
        s2.erase(make_pair(c[tmp.second], tmp.second));
      }
    }
    cout << res << endl;
  }
  return 0;
}
