#include <bits/stdc++.h>
using namespace std;
long long m, n, a[100005], c[100005], t, j, ans;
vector<pair<long long, int> > urut;
int main() {
  scanf("%lld%lld", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i + 1]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", &c[i + 1]);
  }
  for (int i = 1; i <= n; i++) {
    urut.push_back({c[i], i});
  }
  sort(urut.begin(), urut.end());
  int no = 0;
  while (m--) {
    scanf("%lld%lld", &t, &j);
    if (a[t] >= j) {
      a[t] -= j;
      ans = c[t] * j;
    } else {
      ans = a[t] * c[t];
      j -= a[t];
      a[t] = 0;
      if (no >= n) {
        printf("0\n");
        continue;
      }
      int id = urut[no].second;
      while (1) {
        if (a[id] == 0) no++;
        if (no >= n) {
          ans = 0;
          break;
        }
        id = urut[no].second;
        long long ambil = min(a[id], j);
        a[id] -= ambil;
        j -= ambil;
        ans += c[id] * ambil;
        if (j == 0) break;
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
