#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long M[n + 2], c[n + 2];
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  for (long long i = 1; i <= n; i++) cin >> M[i];
  for (long long j = 1; j <= n; j++) {
    cin >> c[j];
    pq.push(make_pair(c[j], j));
  }
  for (long long i = 0; i < m; i++) {
    long long a, b, res = 0;
    cin >> a >> b;
    if (M[a] >= b) {
      cout << c[a] * b;
      M[a] -= b;
    } else if (M[a] < b) {
      b = b - M[a];
      res = res + M[a] * c[a];
      M[a] = 0;
      while (!pq.empty()) {
        long long x = pq.top().second;
        if (M[x] == 0) {
          pq.pop();
          continue;
        }
        if (M[x] >= b) {
          M[x] -= b;
          res = res + b * c[x];
          b = 0;
          break;
        } else {
          b -= M[x];
          res = res + M[x] * c[x];
          M[x] = 0;
        }
      }
      if (b > 0)
        cout << 0;
      else
        cout << res;
    }
    cout << "\n";
  }
  return 0;
}
