#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long NINF = -1e18;
int n, q, val[N], col[N];
long long ans, a, b, curr, dp[N];
pair<long long, long long> otherMax[2], currMax;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> val[i];
  for (int i = 0; i < n; i++) cin >> col[i];
  for (int j = 0; j < q; j++) {
    cin >> a >> b;
    ans = 0;
    for (int i = 0; i <= n; i++) dp[i] = NINF;
    for (int i = 0; i < 2; i++)
      otherMax[i] = pair<long long, long long>(NINF, -i - 1);
    for (int i = 0; i < n; i++) {
      curr = val[i] * b;
      curr = max(curr, dp[col[i]] + val[i] * a);
      for (int k = 0; k < 2; k++)
        if (otherMax[k].second != col[i])
          curr = max(curr, otherMax[k].first + val[i] * b);
      currMax = pair<long long, long long>(curr, col[i]);
      if (otherMax[0].second == col[i])
        otherMax[0].first = max(otherMax[0].first, currMax.first);
      else if (otherMax[1].second == col[i]) {
        otherMax[1].first = max(currMax.first, otherMax[1].first);
        if (otherMax[1].first > otherMax[0].first)
          swap(otherMax[1], otherMax[0]);
      } else if (currMax.first > otherMax[1].first) {
        swap(currMax, otherMax[1]);
        if (otherMax[1].first > otherMax[0].first)
          swap(otherMax[0], otherMax[1]);
      }
      ans = max(curr, ans);
      dp[col[i]] = max(dp[col[i]], curr);
    }
    cout << ans << "\n";
  }
  return 0;
}
