#include <bits/stdc++.h>
using namespace std;
const int MAX = 100001;
int rem[MAX];
int cost[MAX];
pair<int, int> costAndIdx[MAX];
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> foodNum(m);
  vector<int> dishes(m);
  for (int i = 1; i <= n; ++i) {
    cin >> rem[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> cost[i];
    costAndIdx[i] = make_pair(cost[i], i);
  }
  sort(costAndIdx, costAndIdx + n + 1);
  for (int i = 0; i < m; ++i) {
    cin >> foodNum[i] >> dishes[i];
  }
  int cntmin = 1;
  for (int i = 0; i < m; ++i) {
    long long jcost = 0;
    int jthfood = foodNum[i], jthdish = dishes[i];
    while (jthdish != 0) {
      if (rem[jthfood] >= jthdish) {
        jcost += ((long long)cost[jthfood] * jthdish);
        rem[jthfood] -= jthdish;
        jthdish = 0;
      } else if (cntmin > n) {
        jcost = 0;
        break;
      } else {
        jcost += ((long long)cost[jthfood] * rem[jthfood]);
        jthdish -= rem[jthfood];
        rem[jthfood] = 0;
        int mincostFood = costAndIdx[cntmin].second;
        while (rem[mincostFood] == 0 && cntmin <= n) {
          cntmin++;
          mincostFood = costAndIdx[cntmin].second;
        }
        jthfood = mincostFood;
      }
    }
    cout << jcost << '\n';
  }
  return 0;
}
