#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
long long p[100030];
long long n, q, a, b;
long long val[100030];
long long num[100030];
long long Compute() {
  long long Max = 0;
  long long Maxnum = 0;
  long long vMax = 0;
  for (int i = 1; i <= n; i++) p[i] = -1e12;
  for (long long i = 1; i <= n; i++) {
    if (Maxnum == num[i]) {
      p[num[i]] =
          max(p[num[i]], max(p[num[i]] + a * val[i], vMax + b * val[i]));
    } else {
      p[num[i]] = max(p[num[i]], max(p[num[i]] + a * val[i], Max + b * val[i]));
    }
    if (p[num[i]] > Max) {
      if (Maxnum != num[i]) vMax = Max;
      Max = p[num[i]];
      Maxnum = num[i];
    } else if (p[num[i]] > vMax) {
      if (Maxnum == num[i]) continue;
      vMax = p[num[i]];
    }
  }
  return Max;
}
int main() {
  scanf("%I64d%I64d", &n, &q);
  for (long long i = 1; i <= n; i++) scanf("%I64d", &val[i]);
  for (long long i = 1; i <= n; i++) scanf("%I64d", &num[i]);
  while (q--) {
    scanf("%I64d%I64d", &a, &b);
    long long ans = Compute();
    printf("%I64d\n", ans);
  }
  return 0;
}
