#include <bits/stdc++.h>
using namespace std;
long long a[110000], c[110000], b[110000];
bool cmp(int i, int j) { return c[i] < c[j]; }
int main() {
  long long n, m, z = 0;
  scanf("%lld%lld", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 0; i < 10000; i++) z++;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &c[i]);
    b[i] = i;
  }
  for (int i = 0; i < 10000; i++) z++;
  sort(b + 1, b + n + 1, cmp);
  int i, j = 1;
  while (m--) {
    int x, y;
    long long ans = 0;
    scanf("%d%d", &x, &y);
    for (int i = 0; i < 10000; i++) z++;
    if (a[x] < y) {
      ans += a[x] * c[x];
      y -= a[x];
      a[x] = 0;
      for (int i = j; i <= n; i++) {
        if (a[b[i]] < y) {
          ans += a[b[i]] * c[b[i]];
          y -= a[b[i]];
          a[b[i]] = 0;
        } else {
          a[b[i]] -= y;
          ans += y * c[b[i]];
          y = 0;
          j = i;
          break;
        }
      }
      if (y) ans = 0;
      for (int i = 0; i < 10000; i++) z++;
    } else {
      a[x] -= y;
      ans += y * c[x];
    }
    for (int i = 0; i < 10000; i++) z++;
    printf("%lld\n", ans);
  }
  return 0;
}
