#include <bits/stdc++.h>
using namespace std;
int n;
long long a, b;
long long pd[110000];
long long v[110000], c[110000];
int prox[110000];
long long best[110000];
map<int, int> mapa;
bool ja[110000];
pair<long long, long long> atualiza(pair<long long, long long> a, long long x,
                                    long long ant) {
  if (a.first == ant) return make_pair(x, a.second);
  if (a.second == ant) {
    long long c = a.first, d = x;
    return make_pair(max(c, d), min(c, d));
  }
  if (x > a.first) return make_pair(x, a.first);
  return make_pair(a.first, max(a.second, x));
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) cin >> c[i], c[i]--;
  multiset<int> S;
  while (q--) {
    memset(pd, -1, sizeof pd);
    cin >> a >> b;
    memset(best, 0, sizeof best);
    for (int i = 0; i < n; i++) best[i] = -(1LL << 50);
    memset(ja, 0, sizeof ja);
    S.clear();
    pair<long long, long long> ans = make_pair(0, 0);
    for (int i = 0; i < n; i++) {
      long long sem;
      if (ans.first == best[c[i]])
        sem = ans.second;
      else
        sem = ans.first;
      long long aux = sem + b * v[i];
      if (ja[c[i]]) aux = max(aux, best[c[i]] + a * v[i]);
      long long ant = best[c[i]];
      best[c[i]] = max(best[c[i]], aux);
      ja[c[i]] = 1;
      if (ant != best[c[i]]) ans = atualiza(ans, best[c[i]], ant);
    }
    long long ret = 0;
    for (int i = 0; i < n; i++) ret = max(ret, best[i]);
    cout << ret << endl;
  }
  return 0;
}
