#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int index;
  long long int qty;
  long long int prc;
} DISHES;
bool descSort(DISHES d1, DISHES d2) {
  if (d1.prc == d2.prc) {
    return d1.index < d2.index;
  } else {
    return d1.prc < d2.prc;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  DISHES orgnl[n + 1];
  DISHES srted[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> orgnl[i].qty;
    srted[i].qty = orgnl[i].qty;
    orgnl[i].index = i;
    srted[i].index = i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> orgnl[i].prc;
    srted[i].prc = orgnl[i].prc;
  }
  sort(srted + 1, srted + n + 1, descSort);
  for (int i = 1; i <= n; i++) {
    orgnl[srted[i].index].index = i;
  }
  int lastFilled = 1;
  for (int i = 0; i < m; i++) {
    long long int dish, amount;
    long long int totalCost = 0;
    cin >> dish >> amount;
    if (orgnl[dish].qty >= amount) {
      orgnl[dish].qty -= amount;
      srted[orgnl[dish].index].qty -= amount;
      totalCost = amount * orgnl[dish].prc;
      cout << totalCost << "\n";
    } else {
      totalCost = orgnl[dish].qty * orgnl[dish].prc;
      amount -= orgnl[dish].qty;
      orgnl[dish].qty = 0;
      srted[orgnl[dish].index].qty = 0;
      int j = lastFilled;
      while (amount && j <= n) {
        if (srted[j].qty >= amount) {
          totalCost += amount * srted[j].prc;
          srted[j].qty -= amount;
          orgnl[srted[j].index].qty -= amount;
          amount = 0;
        } else {
          totalCost += srted[j].prc * srted[j].qty;
          amount -= srted[j].qty;
          srted[j].qty = 0;
          orgnl[srted[j].index].qty = 0;
          j++;
          lastFilled++;
        }
      }
      if (amount != 0) {
        cout << "0\n";
      } else {
        cout << totalCost << "\n";
      }
    }
  }
  return 0;
}
