#include <bits/stdc++.h>
using namespace std;
long long dp[100010];
long long col[100010], val[100010];
long long mxm(long long a, long long b);
long long mxm(long long a, long long b, long long c);
int main() {
  ios_base::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> val[i];
  for (int i = 0; i < n; i++) cin >> col[i];
  long long a, b, max1 = 0, max2 = 0, poz1 = -1, grandmax = 0, poz2;
  while (q--) {
    max1 = max2 = poz1 = grandmax = 0;
    poz2 = -1;
    for (int i = 1; i <= n; i++) dp[i] = -(1ll << 62);
    cin >> a >> b;
    for (int i = 0; i < n; i++) {
      dp[col[i]] =
          mxm(1ll * dp[col[i]], 1ll * dp[col[i]] + 1ll * a * val[i],
              (poz1 != col[i] ? 1ll * max1 : 1ll * max2) + 1ll * b * val[i]);
      if (1ll * dp[col[i]] > 1ll * max1) {
        if (poz1 != col[i]) {
          max2 = 1ll * max1;
          poz2 = poz1;
        }
        max1 = dp[col[i]];
        poz1 = col[i];
      } else if (1ll * dp[col[i]] > 1ll * max2 && col[i] != poz1) {
        max2 = 1ll * dp[col[i]];
        poz2 = col[i];
      }
      if (1ll * max1 > 1ll * grandmax) grandmax = 1ll * max1;
    }
    cout << grandmax << '\n';
  }
}
long long mxm(long long a, long long b) { return (a > b ? a : b); }
long long mxm(long long a, long long b, long long c) {
  return mxm(a, mxm(b, c));
}
