#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long A[N], C[N];
struct P {
  long long a;
  long long c;
} f[N];
int cmp(P x, P y) {
  if (x.c == y.c) return x.a < y.a;
  return x.c < y.c;
}
int main() {
  int n, m;
  long long t, d;
  long long sum;
  unsigned long long ans;
  cin >> n >> m;
  sum = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> A[i];
    sum += A[i];
  }
  for (long long i = 1; i <= n; i++) {
    cin >> C[i];
    f[i].a = i;
    f[i].c = C[i];
  }
  sort(f + 1, f + n + 1, cmp);
  long long pos = 1;
  while (m--) {
    ans = 0;
    cin >> t >> d;
    if (sum - d >= 0) {
      sum -= d;
    } else {
      sum = 0;
      cout << 0 << endl;
      continue;
    }
    while (d) {
      if (A[t] - d >= 0) {
        A[t] -= d;
        ans += d * C[t];
        d = 0;
        break;
      } else {
        d -= A[t];
        ans += A[t] * C[t];
        A[t] = 0;
        while (A[f[pos].a] == 0) pos++;
        long long poss = f[pos].a;
        if (A[poss] >= d) {
          A[poss] -= d;
          ans += d * C[poss];
          d = 0;
        } else {
          ans += A[poss] * C[poss];
          d -= A[poss];
          A[poss] = 0;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
