#include <bits/stdc++.h>
using namespace std;
int n, q;
vector<int> val, color;
long long maxColor[100001];
bool exist[100001];
int main(void) {
  cin >> n >> q;
  int temp;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    val.push_back(temp);
  }
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    color.push_back(temp);
  }
  long long a, b;
  for (int i = 0; i < q; ++i) {
    cin >> a >> b;
    int maxIndex1 = 0, maxIndex2 = 0;
    memset(exist, false, sizeof(exist));
    for (int j = 0; j < n; ++j) {
      long long maxVal = b * val[j];
      if (exist[color[j]]) {
        maxVal = max(maxVal, maxColor[color[j]] + a * val[j]);
      }
      if (maxIndex1 && maxIndex1 != color[j]) {
        maxVal = max(maxVal, maxColor[maxIndex1] + b * val[j]);
      } else if (maxIndex2 && maxIndex2 != color[j]) {
        maxVal = max(maxVal, maxColor[maxIndex2] + b * val[j]);
      }
      if (!exist[color[j]])
        maxColor[color[j]] = maxVal;
      else
        maxColor[color[j]] = max(maxColor[color[j]], maxVal);
      exist[color[j]] = true;
      if (!maxIndex1 || maxColor[color[j]] >= maxColor[maxIndex1]) {
        if (color[j] != maxIndex1) {
          maxIndex2 = maxIndex1;
          maxIndex1 = color[j];
        }
      } else if (!maxIndex2 || maxColor[color[j]] > maxColor[maxIndex2]) {
        maxIndex2 = color[j];
      }
    }
    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
      if (exist[i]) ans = max(ans, maxColor[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
