#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int a[MAXN], c[MAXN];
pair<int, int> q[MAXN];
int main() {
  long long ans;
  int n, m, t, d, j;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    q[i] = pair<int, int>(c[i], i);
  }
  sort(q + 1, q + n + 1);
  j = 1;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &t, &d);
    if (d <= a[t]) {
      a[t] -= d;
      cout << (long long)d * c[t] << endl;
      continue;
    }
    ans = (long long)a[t] * c[t];
    d -= a[t];
    a[t] = 0;
    while (j <= n && d > 0) {
      while (j <= n && a[q[j].second] <= 0) j++;
      if (j > n) break;
      if (d <= a[q[j].second]) {
        a[q[j].second] -= d;
        ans += (long long)d * c[q[j].second];
        d = 0;
        continue;
      }
      ans += (long long)a[q[j].second] * c[q[j].second];
      d -= a[q[j].second];
      a[q[j].second] = 0;
    }
    if (d == 0)
      cout << ans << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
