#include <bits/stdc++.h>
using namespace std;
long long n, m, rem[100004], cost[100004], t, d, kind, num, dif, total;
struct s {
  int price, idx;
} v[100004];
queue<s> q;
bool cmp(s a, s b) {
  if (a.price == b.price) return a.idx < b.idx;
  return a.price < b.price;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> rem[i];
    v[i].idx = i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> cost[i];
    v[i].price = cost[i];
  }
  sort(v + 1, v + n + 1, cmp);
  for (int i = 1; i <= n; i++) q.push(v[i]);
  for (int i = 1; i <= m; i++) {
    cin >> kind >> num;
    total = 0;
    if (num <= rem[kind]) {
      rem[kind] -= num;
      cout << cost[kind] * num << '\n';
    } else {
      total = rem[kind] * cost[kind];
      dif = num - rem[kind];
      rem[kind] = 0;
      while (!q.empty() && dif > 0) {
        if (rem[q.front().idx] == 0) {
          q.pop();
          continue;
        }
        if (dif <= rem[q.front().idx]) {
          rem[q.front().idx] -= dif;
          cout << dif * q.front().price + total << '\n';
          dif = 0;
        } else {
          dif -= rem[q.front().idx];
          total += q.front().price * rem[q.front().idx];
          rem[q.front().idx] = 0;
          q.pop();
        }
      }
      if (dif > 0) cout << 0 << '\n';
    }
  }
  return 0;
}
