#include <bits/stdc++.h>
using namespace std;
struct node {
  long long int name, cost;
} mmap[100010];
int n, m;
long long int book[100010], coss[100010];
int cmp(node a, node b) { return a.cost < b.cost; }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> book[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> coss[i];
  }
  for (int i = 1; i <= n; i++) {
    mmap[i].name = i;
    mmap[i].cost = coss[i];
  }
  sort(mmap + 1, mmap + 1 + n, cmp);
  int now = 1;
  long long int t, d;
  for (int i = 1; i <= m; i++) {
    cin >> t >> d;
    long long int anss = 0;
    if (book[t]) {
      if (book[t] >= d) {
        anss += d * coss[t];
        book[t] -= d;
        d = 0;
      } else {
        anss += book[t] * coss[t];
        d -= book[t];
        book[t] = 0;
      }
    }
    while (d) {
      if (now > n) break;
      if (book[mmap[now].name] == 0) {
        now++;
        continue;
      }
      if (book[mmap[now].name] > d) {
        anss += mmap[now].cost * d;
        book[mmap[now].name] -= d;
        d = 0;
      } else {
        anss += mmap[now].cost * book[mmap[now].name];
        d -= book[mmap[now].name];
        book[mmap[now].name] = 0;
      }
    }
    if (d) {
      cout << 0 << endl;
    } else
      cout << anss << endl;
  }
  return 0;
}
