#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
long long n, m, a[maxn], b[maxn], c[maxn], d[maxn];
struct node {
  long long in, x;
} s[maxn];
bool cmp(node a, node b) { return a.x < b.x || (a.x == b.x && a.in < b.in); }
signed main() {
  scanf("%I64d%I64d", &n, &m);
  for (long long i = 1; i <= n; i++) scanf("%I64d", a + i);
  for (long long i = 1; i <= n; i++)
    scanf("%I64d", b + i), s[i].x = b[i], s[i].in = i;
  for (long long i = 1; i <= m; i++) scanf("%I64d%I64d", &c[i], &d[i]);
  sort(s + 1, s + 1 + n, cmp);
  long long tot, k = 1;
  for (long long i = 1; i <= m; i++) {
    tot = 0;
    if (a[c[i]] > 0) {
      if (d[i] <= a[c[i]])
        tot += d[i] * b[c[i]], a[c[i]] -= d[i], d[i] = 0;
      else
        tot += a[c[i]] * b[c[i]], d[i] -= a[c[i]], a[c[i]] = 0;
    }
    if (d[i] > 0) {
      while (d[i] != 0 && k <= n) {
        if (a[s[k].in] > 0) {
          if (d[i] <= a[s[k].in])
            tot += d[i] * b[s[k].in], a[s[k].in] -= d[i], d[i] = 0;
          else
            tot += a[s[k].in] * b[s[k].in], d[i] -= a[s[k].in], a[s[k].in] = 0;
        }
        if (a[s[k].in] == 0) k++;
      }
    }
    if (d[i] > 0) tot = 0;
    printf("%I64d\n", tot);
  }
  return 0;
}
