#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100010;
long long dp[Maxn];
void init() {
  for (int i = 0; i < Maxn; ++i) dp[i] = -1e18;
  dp[Maxn - 1] = 0;
}
int n, q;
long long v[Maxn], c[Maxn];
void solve(long long a, long long b) {
  int max1 = Maxn - 1, max2 = Maxn - 1;
  init();
  for (int i = 0; i < n; ++i) {
    long long tmp = max(dp[c[i]] + v[i] * a, dp[max2] + v[i] * b);
    if (max1 != c[i]) tmp = max(tmp, dp[max1] + v[i] * b);
    dp[c[i]] = max(tmp, dp[c[i]]);
    if (max1 != c[i] && dp[max1] < tmp)
      max2 = max1, max1 = c[i];
    else if (max1 != c[i] && dp[max2] < tmp)
      max2 = c[i];
  }
  printf("%I64d\n", dp[max1]);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; ++i) scanf("%I64d", &v[i]);
  for (int i = 0; i < n; ++i) scanf("%I64d", &c[i]);
  for (int i = 0; i < q; ++i) {
    long long x, y;
    scanf("%I64d%I64d", &x, &y);
    solve(x, y);
  }
  return 0;
}
