#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[N], c[N];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
    pq.push({c[i], i});
  }
  while (m--) {
    int t, d;
    scanf("%d %d", &t, &d);
    swap(t, d);
    d--;
    int qtd = 0;
    long long val = 0LL;
    if (t <= a[d]) {
      a[d] -= t;
      qtd = t;
      val += ((long long)(qtd)*c[d]);
    } else {
      qtd = a[d];
      a[d] = 0;
      val += ((long long)(qtd)*c[d]);
    }
    while (qtd < t && !pq.empty()) {
      pair<int, int> x = pq.top();
      pq.pop();
      int rest = t - qtd;
      if (rest <= a[x.second]) {
        a[x.second] -= rest;
        val += ((long long)(rest)*c[x.second]);
        qtd += rest;
      } else {
        qtd += a[x.second];
        val += ((long long)(a[x.second]) * c[x.second]);
        a[x.second] = 0;
      }
      if (a[x.second] > 0) pq.push({x.first, x.second});
    }
    if (qtd < t) val = 0;
    printf("%lld\n", val);
  }
}
