#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
int a[N], c[N], t[N], d[N];
int main()
{
    int n, m;
    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);
    for (int i = 1; i <= m; i++) scanf("%d%d", t + i, d + i);
    set<pair<int, int>> S;
    for (int i = 1; i <= n; i++) S.insert(make_pair(c[i], i));
    for (int i = 1; i <= m; i++)
    {
        long long sum = 0;
        int lft = d[i], cur = t[i];
        if (a[cur] >= lft)
        {
            sum += 1ll * lft * c[cur];
            a[cur] -= lft;
            lft = 0;
        }
        else
        {
            sum += 1ll * a[cur] * c[cur];
            lft -= a[cur];
            a[cur] = 0;
        }
        while (lft)
        {
            if (S.empty())
            {
                sum = 0;
                break;
            }
            cur = S.begin()->second;
            if (a[cur] >= lft)
            {
                sum += 1ll * lft * c[cur];
                a[cur] -= lft;
                lft = 0;
            }
            else
            {
                sum += 1ll * a[cur] * c[cur];
                lft -= a[cur];
                a[cur] = 0;
            }
            if (a[cur] == 0) S.erase(S.begin());
        }
        printf("%lld\n", sum);
    }
    return 0;

}
