#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
int main() {
  int n, m;
  cin >> n >> m;
  int a[n + 1];
  vector<pair<int, int>> b;
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
  }
  int c[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> c[i + 1];
    b.push_back({c[i + 1], i + 1});
  }
  sort(b.begin(), b.end());
  int p = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    long long cost = 0;
    if (a[x] >= y) {
      a[x] -= y;
      cost += (long long)y * c[x];
      y = 0;
    } else {
      cost += (long long)a[x] * c[x];
      y -= a[x];
      a[x] = 0;
    }
    if (y) {
      while (y && p < n) {
        if (a[b[p].second]) {
          if (a[b[p].second] >= y) {
            cost += (long long)y * c[b[p].second];
            a[b[p].second] -= y;
            y = 0;
          } else {
            cost += (long long)a[b[p].second] * c[b[p].second];
            y -= a[b[p].second];
            a[b[p].second] = 0;
          }
        }
        p++;
      }
      p--;
    }
    if (y) {
      cost = 0;
    }
    cout << cost << "\n";
  }
  return 0;
}
