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