#include <bits/stdc++.h>
using namespace std;
int mod = 1000000000 + 7;
const int N = 102000;
const double PI = acos(-1);
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  long long a[n], c[n];
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int i = 0; i < n; i++) scanf("%lld", &c[i]);
  vector<pair<long long, long long> > v;
  for (int i = 0; i < n; i++) {
    v.push_back(make_pair(c[i], i));
  }
  sort(v.begin(), v.end());
  int j = 0;
  long long ans = 0;
  while (m > 0) {
    m--;
    int type, km;
    scanf("%d%d", &type, &km);
    type--;
    while (j < n && a[v[j].second] == 0) j++;
    if (j == n) {
      cout << 0 << endl;
      continue;
    }
    if (a[type] >= km) {
      a[type] -= km;
      ans += (km * c[type]);
      cout << ans << endl;
      ans = 0;
      continue;
    }
    long long tmp = c[type] * a[type];
    km -= a[type];
    a[type] = 0;
    while (km > 0) {
      if (j == n) {
        ans = 0;
        break;
      }
      if (a[v[j].second] == 0) {
        j++;
        continue;
      }
      int t = v[j].second;
      if (a[v[j].second] >= km) {
        a[v[j].second] -= km;
        ans += ((km * c[v[j].second]) + tmp);
        break;
      } else {
        tmp += (c[t] * a[t]);
        km -= a[t];
        a[t] = 0;
      }
    }
    cout << ans << endl;
    ans = 0;
  }
  return 0;
}
