#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 100;
const int maxm = 200000 + 100;
const int maxs = 256;
const long long unit = 1LL;
const int INF = 0x3f3f3f3f;
const double eps = 1e-14;
const double inf = 1e15;
const double pi = acos(-1.0);
const int SIZE = 100 + 5;
const long long MOD = 1000000007;
int n, m;
int remain[maxn];
int cost[maxn];
struct Food {
  int ind, price;
  Food(int ind, int price) : ind(ind), price(price) {}
  bool operator<(const Food &a) const {
    if (price == a.price) {
      return ind < a.ind;
    } else {
      return price < a.price;
    }
  }
};
vector<Food> vec;
list<Food> lis;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> remain[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> cost[i];
    vec.push_back((Food){i, cost[i]});
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); i++) {
    lis.push_back(vec[i]);
  }
  int d, t;
  while (m--) {
    cin >> t >> d;
    int x = min(remain[t], d);
    remain[t] -= x;
    d -= x;
    long long sum = (long long)x * cost[t];
    if (!d) {
      cout << sum << endl;
      continue;
    }
    for (list<Food>::iterator iter = lis.begin(); iter != lis.end();) {
      Food it = *iter;
      if (!remain[it.ind]) {
        iter = lis.erase(iter);
      } else {
        x = min(remain[it.ind], d);
        remain[it.ind] -= x;
        d -= x;
        sum += (long long)x * cost[it.ind];
        if (!d) {
          cout << sum << endl;
          break;
        }
        iter++;
      }
    }
    if (d) {
      cout << 0 << endl;
    }
  }
  return 0;
}
