#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
long long C[100009], V[100009];
long long dp[100009];
int main() {
  int n, q, i, j, a, b;
  cin >> n >> q;
  for (i = 0; i < n; i++) scanf("%I64d", &V[i]);
  for (i = 0; i < n; i++) scanf("%I64d", &C[i]);
  while (q--) {
    scanf("%d %d", &a, &b);
    long long ans = 0;
    long long m1 = -1000000000ll * 1000000000, m2 = -1000000000ll * 1000000000;
    fill(dp, dp + n + 1, m1);
    for (i = 0; i < n; i++) {
      long long res = max(dp[C[i]] + V[i] * a, b * V[i]);
      long long cur = dp[C[i]];
      if (m1 == cur) {
        res = max(res, b * V[i] + m2);
        dp[C[i]] = max(dp[C[i]], res);
        m1 = dp[C[i]];
      } else {
        res = max(res, b * V[i] + m1);
        dp[C[i]] = max(dp[C[i]], res);
        m2 = max(m2, dp[C[i]]);
        if (m2 > m1) swap(m1, m2);
      }
      ans = max(ans, res);
    }
    cout << ans << endl;
  }
}
