#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool isperfect(long long n) {
  long long y = sqrt(n);
  if (n % y == 0 && y * y == n) return true;
  return false;
}
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.second < b.second;
}
long long powi(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = ans * a;
    b = (b >> 1);
    a = a * a;
  }
  return ans;
}
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long int> d(n), c(n);
  for (long long i = 0; i < n; i++) cin >> d[i];
  for (long long i = 0; i < n; i++) cin >> c[i];
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < n; i++) {
    v.push_back(make_pair(c[i], i));
  }
  sort(v.begin(), v.end());
  int j = 0;
  for (int i = 0; i < m; i++) {
    int di, cnt;
    cin >> di >> cnt;
    long long x = 0;
    if (cnt <= d[di - 1]) {
      d[di - 1] -= cnt;
      x = cnt * c[di - 1];
      cnt = 0;
    } else {
      x = (d[di - 1]) * c[di - 1];
      cnt -= d[di - 1];
      d[di - 1] = 0;
      while (cnt > 0 && j < n) {
        if (cnt <= d[v[j].second]) {
          d[v[j].second] -= cnt;
          x += cnt * (v[j].first);
          cnt = 0;
        } else {
          x += (d[v[j].second] * (v[j].first));
          cnt -= d[v[j].second];
          d[v[j].second] = 0;
          j++;
        }
      }
    }
    if (cnt <= 0)
      cout << x << endl;
    else
      cout << "0 " << endl;
  }
}
