#include <bits/stdc++.h>
using namespace std;
int c[100010], v[100010];
long long mii[100010];
int max1, max2;
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  for (int j = 0; j < q; j++) {
    int a, b;
    scanf("%d %d", &a, &b);
    for (int i = 1; i <= n; i++) mii[i] = -1e12;
    max1 = 0, max2 = 0;
    for (int i = 0; i < n; i++) {
      if (mii[c[i]] != -1e12)
        mii[c[i]] = max(mii[c[i]], mii[c[i]] + a * 1LL * v[i]);
      mii[c[i]] = max(mii[c[i]], b * 1LL * v[i]);
      if (max1 != c[i])
        mii[c[i]] = max(mii[c[i]], mii[max1] + b * 1LL * v[i]);
      else if (max2 != c[i])
        mii[c[i]] = max(mii[c[i]], mii[max2] + b * 1LL * v[i]);
      if (mii[c[i]] > mii[max1]) max2 = max1, max1 = c[i];
      if (c[i] != max1 && mii[c[i]] > mii[max2]) max2 = c[i];
    }
    printf("%I64d\n", mii[max1]);
  }
  return 0;
}
