#include <bits/stdc++.h>
using namespace std;
long long dp[100100];
bool vis[100100];
long long c[100100];
long long v[100100];
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) scanf("%I64d", &v[i]);
  for (int i = 0; i < n; i++) scanf("%I64d", &c[i]);
  while (q--) {
    for (int i = 0; i <= n; i++) {
      dp[i] = -1e15;
      vis[i] = 0;
    }
    long long a, b;
    cin >> a >> b;
    pair<long long, long long> maxx[3];
    for (int i = 0; i < 3; i++) {
      maxx[i] = make_pair(-1e15, -1);
    }
    long long res = 0;
    for (int i = 0; i < n; i++) {
      if (vis[c[i]]) dp[c[i]] = max(dp[c[i]], a * v[i] + dp[c[i]]);
      dp[c[i]] = max(dp[c[i]], v[i] * b);
      vis[c[i]] = 1;
      for (int j = 2; j >= 0; j--)
        if (c[i] != maxx[j].second && maxx[j].second != -1) {
          dp[c[i]] = max(dp[c[i]], (long long)b * v[i] + maxx[j].first);
          break;
        }
      bool b = 0;
      for (int j = 0; j < 3; j++) {
        if (c[i] == maxx[j].second) {
          maxx[j] = make_pair(dp[c[i]], c[i]);
          b = 1;
          break;
        }
      }
      if (!b) maxx[0] = make_pair(dp[c[i]], c[i]);
      res = max(res, dp[c[i]]);
      sort(maxx, maxx + 3);
    }
    cout << res << endl;
  }
  return 0;
}
