#include <bits/stdc++.h>
using namespace std;
long long a[100010], t[100010];
long long d[100010], c[100010];
int main() {
  int n, m;
  while (cin >> n >> m) {
    long long ans = 0;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
      scanf("%lld", a + i);
    }
    vector<pair<long long, long long> > v;
    for (int i = 0; i < n; ++i) {
      scanf("%lld", c + i);
      v.push_back(make_pair(c[i], i));
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < m; ++i) {
      scanf("%lld%lld", t + i, d + i);
      --t[i];
      if (a[t[i]] >= d[i]) {
        ans = c[t[i]] * d[i];
        a[t[i]] -= d[i];
        d[i] = 0;
      } else {
        ans = c[t[i]] * a[t[i]];
        d[i] -= a[t[i]];
        a[t[i]] = 0;
        for (cnt; cnt < n; ++cnt) {
          if (a[v[cnt].second] >= d[i]) {
            ans += d[i] * v[cnt].first;
            a[v[cnt].second] -= d[i];
            d[i] = 0;
            break;
          } else {
            ans += a[v[cnt].second] * v[cnt].first;
            d[i] -= a[v[cnt].second];
            a[v[cnt].second] = 0;
          }
        }
      }
      if (d[i])
        cout << 0 << endl;
      else
        cout << ans << endl;
    }
  }
  return 0;
}
