#include <bits/stdc++.h>
#pragma GCC optimization("O3")
using namespace std;
template <typename T>
inline void Cin(T& first) {
  char c;
  T sign = 1;
  first = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) first = first * 10 + c - '0';
  first *= sign;
}
template <typename T>
inline void Out(T first) {
  if (first > 9) Out(first / 10);
  putchar(first % 10 + '0');
}
template <typename T>
inline void Cout(T first, char c) {
  if (first < 0) putchar('-');
  first = abs(first);
  Out(first);
  putchar(c);
}
template <typename T, typename... Args>
inline void Cin(T& a, Args&... args) {
  Cin(a);
  Cin(args...);
}
template <typename T, typename... Args>
inline void Cout(T a, char c, Args... args) {
  Cout(a, c);
  Cout(args...);
}
const int mod = int(1e9) + 7;
const int N = int(1e5) + 7;
vector<int> v, c;
vector<long long> f;
int n, Q, Max, _Max;
bitset<N> vis;
long long a, b;
void Enter() {
  cin >> n >> Q;
  c.resize(n + 1), v.resize(n + 1), f.resize(n + 1);
  for (int i = 1; i <= n; ++i) cin >> v[i];
  for (int i = 1; i <= n; ++i) cin >> c[i];
}
void Update(int first) {
  if (Max == -1 || (f[first] >= f[Max] && Max != first))
    _Max = Max, Max = first;
  if (_Max == -1 || (f[first] >= f[_Max] && Max != first)) _Max = first;
}
void Solve() {
  while (Q--) {
    cin >> a >> b;
    Max = -1, _Max = -1;
    vis.reset();
    fill(f.begin(), f.end(), (long long)-1e18);
    for (int i = 1; i <= n; ++i) {
      if (vis.test(c[i]))
        f[c[i]] = max({f[c[i]], f[c[i]] + a * v[i], b * v[i]});
      else
        f[c[i]] = b * v[i];
      if (Max != -1 && Max != c[i])
        f[c[i]] = max(f[c[i]], f[Max] + b * v[i]);
      else if (_Max != -1 && _Max != c[i])
        f[c[i]] = max(f[c[i]], f[_Max] + b * v[i]);
      Update(c[i]);
      vis.set(c[i]);
    }
    cout << max(f[Max], 0ll) << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("test"
            ".inp",
            "r")) {
    freopen(
        "test"
        ".inp",
        "r", stdin);
    freopen(
        "test"
        ".out",
        "w", stdout);
  }
  Enter(), Solve();
  return 0;
}
