#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long v[maxn], f[maxn];
int c[maxn], N, Q;
int main() {
  scanf("%d%d", &N, &Q);
  for (int i = 1; i <= N; ++i) scanf("%I64d", &v[i]);
  for (int i = 1; i <= N; ++i) scanf("%d", &c[i]);
  for (int q = 1, A, B; q <= Q; ++q) {
    scanf("%d%d", &A, &B);
    int p1 = 0, p2 = 0;
    memset(f, -60, sizeof(f));
    long long ans = 0;
    for (int i = 1; i <= N; ++i) {
      long long G = v[i] * B;
      (G = (f[c[i]] + v[i] * A) > (G) ? (f[c[i]] + v[i] * A) : (G));
      (G = (f[(p1 == c[i]) ? p2 : p1] + v[i] * B) > (G)
               ? (f[(p1 == c[i]) ? p2 : p1] + v[i] * B)
               : (G));
      (f[c[i]] = (G) > (f[c[i]]) ? (G) : (f[c[i]]));
      (ans = (G) > (ans) ? (G) : (ans));
      if (p1 != c[i] && p2 != c[i]) p2 = (f[p2] > f[c[i]]) ? p2 : c[i];
      if (f[p2] > f[p1]) swap(p1, p2);
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
