#include <bits/stdc++.h>
using namespace std;
;
const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 1e5 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
int n, m, x, y;
int a[maxn], c[maxn];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    q.push({c[i], i});
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    int tmp = min(y, a[x]);
    a[x] -= tmp;
    y -= tmp;
    long long cnt = 1LL * tmp * c[x];
    if (y > 0) {
      while (!q.empty()) {
        int t = q.top().second;
        q.pop();
        tmp = min(y, a[t]);
        y -= tmp;
        a[t] -= tmp;
        cnt += 1LL * c[t] * tmp;
        if (y == 0) {
          q.push({c[t], t});
          break;
        }
      }
    }
    if (y > 0) {
      cnt = 0;
    }
    printf("%lld\n", cnt);
  }
  return 0;
}
