#include <bits/stdc++.h>
using namespace std;
const long long EPS = (long long)5e18;
const long long eps = 5e18 + 7;
const long double inf = 1e-10;
bool f(vector<vector<char> > &a, int i, int j) {
  return a[i][j] == 'X' && a[i - 1][j - 1] == 'X' && a[i + 1][j - 1] == 'X' &&
         a[i - 1][j + 1] == 'X' && a[i + 1][j + 1] == 'X';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<long long> a(n + 1), c(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  set<pair<long long, long long> > M;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    M.insert(pair<long long, long long>(c[i], i));
  }
  for (int i = 0; i < m; ++i) {
    long long sum = 0, d, t;
    cin >> t >> d;
    sum += min(a[t], d) * c[t];
    long long val = min(a[t], d);
    a[t] -= val;
    d -= val;
    if (a[t] == 0) {
      M.erase(pair<long long, long long>(c[t], t));
    }
    while (!M.empty() && d > 0) {
      sum += min(a[M.begin()->second], d) * M.begin()->first;
      long long val = min(a[M.begin()->second], d);
      a[M.begin()->second] -= val;
      d -= val;
      if (a[M.begin()->second] == 0) {
        M.erase(pair<long long, long long>(c[M.begin()->second],
                                           M.begin()->second));
      }
    }
    if (d > 0) {
      cout << 0 << endl;
    } else {
      cout << sum << endl;
    }
  }
  return 0;
}
