#include <bits/stdc++.h>
using namespace std;
const int maxn = 101000;
const long long inf = (long long)1e18;
int n, q, color[maxn + 1];
long long a, b, dp[maxn], data[maxn];
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> data[i];
  for (int i = 0; i < n; i++) cin >> color[i];
  for (int it = 0; it < q; it++) {
    cin >> a >> b;
    fill(dp + 1, dp + n + 1, -inf);
    dp[0] = 0;
    int max1 = 0, max2 = 1;
    for (int i = 0; i < n; i++) {
      long long val = b * data[i];
      if (dp[color[i]] != -inf) val = max(val, dp[color[i]] + data[i] * a);
      if (max1 != color[i]) val = max(val, dp[max1] + data[i] * b);
      if (max2 != color[i]) val = max(val, dp[max2] + data[i] * b);
      dp[color[i]] = max(dp[color[i]], val);
      if (color[i] != max1 && val > dp[max2]) max2 = color[i];
      if (dp[max2] > dp[max1]) swap(max2, max1);
    }
    cout << *max_element(dp, dp + n + 1) << endl;
  }
  return 0;
}
