#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m;
  std::cin >> n >> m;
  std::vector<int64_t> dishes(n);
  std::vector<int64_t> cost(n);
  std::vector<std::pair<int, int>> idx;
  for (int i = 0; i < n; ++i) {
    std::cin >> dishes[i];
  }
  for (int i = 0; i < n; ++i) {
    std::cin >> cost[i];
    idx.emplace_back(cost[i], i);
  }
  std::sort(idx.begin(), idx.end());
  auto k = 0u;
  for (int i = 0; i < m; ++i) {
    int64_t total = 0;
    int64_t kind, qty;
    std::cin >> kind >> qty;
    int index = kind - 1;
    while (k < idx.size() && qty > 0) {
      while (dishes[index] == 0) {
        if (index == idx[k].second) {
          ++k;
          if (k == idx.size()) {
            index = -1;
            break;
          }
        }
        index = idx[k].second;
      }
      if (index < 0) {
        break;
      }
      int64_t served = std::min(qty, dishes[index]);
      total += served * cost[index];
      dishes[index] -= served;
      qty -= served;
    }
    std::cout << (qty > 0 ? 0 : total) << std::endl;
  }
}
