#include <bits/stdc++.h>
using namespace std;
long long dp[100005], v[100005];
int c[100005], visited[100005];
long long solve(int n, int a, int b) {
  memset(visited, 0, sizeof(visited));
  memset(dp, 0, sizeof(visited));
  long long mx = 0, other_mx = 0;
  int idx = 0;
  for (int i = 0; i < n; i++) {
    if (!visited[c[i]]) {
      dp[c[i]] = mx + b * v[i];
      visited[c[i]] = 1;
    } else {
      long long not_same;
      if (idx == c[i])
        not_same = other_mx + b * v[i];
      else
        not_same = mx + b * v[i];
      dp[c[i]] = max(dp[c[i]], max(dp[c[i]] + a * v[i], not_same));
    }
    if (dp[c[i]] >= mx) {
      if (idx != c[i]) other_mx = mx;
      mx = dp[c[i]];
      idx = c[i];
    } else if (dp[c[i]] >= other_mx)
      other_mx = dp[c[i]];
  }
  long long ret = 0;
  for (int i = 1; i <= n; i++) ret = max(ret, dp[i]);
  return ret;
}
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  while (q--) {
    int a, b;
    cin >> a >> b;
    cout << solve(n, a, b) << "\n";
  }
  return 0;
}
