#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long n, q, color[N], val[N];
long long solve(long long a, long long b) {
  long long ans = 0, clr[n + 2], dp[n + 2], idx = 0, idx2 = 0;
  for (int i = 1; i <= n; i++) {
    clr[i] = -1e18, dp[i] = -1e18;
  }
  dp[0] = 0;
  dp[1] = max(val[1] * b, (long long)0);
  clr[color[1]] = val[1] * b;
  ans = max(ans, dp[1]);
  idx = 1;
  for (int i = 2; i <= n; i++) {
    if (color[idx] != color[i]) {
      dp[i] = dp[idx] + val[i] * b;
    }
    if (color[idx2] != color[i]) dp[i] = max(dp[i], dp[idx2] + val[i] * b);
    if (clr[color[i]] != -1e18) {
      dp[i] = max(dp[i], a * val[i] + clr[color[i]]);
    }
    dp[i] = max(dp[i], b * val[i]);
    clr[color[i]] = max(clr[color[i]], dp[i]);
    dp[i] = max(dp[i], (long long)0);
    if (color[idx] == color[i] && dp[i] > dp[idx])
      idx = i;
    else if (color[idx2] == color[i] && dp[i] > dp[idx2])
      idx2 = i;
    if (color[idx] != color[i] && color[idx2] != color[i]) {
      if ((!idx2) || (dp[idx] > dp[idx2] && dp[i] > dp[idx2]))
        idx2 = i;
      else if (dp[idx2] >= dp[idx] && dp[i] > dp[idx])
        idx = i;
    }
    ans = max(ans, dp[i]);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  scanf("%lld%lld", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%lld", &val[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &color[i]);
  while (q--) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    printf("%lld\n", solve(a, b));
  }
  return 0;
}
