#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
bool vis[N];
long long n, q, a, b, v[N], c[N], dp[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = 0; i < n; ++i) cin >> c[i];
  while (q--) {
    long long a, b, ans = 0, mx1 = 0, mx2 = 0, idx1 = -1, idx2 = -1;
    cin >> a >> b;
    for (int i = 0; i < N; ++i) dp[i] = -1e18;
    for (int i = 0; i < n; ++i) {
      long long tmp_mx = max(b * v[i], dp[c[i]] + a * v[i]);
      if (idx1 != c[i])
        tmp_mx = max(tmp_mx, mx1 + b * v[i]);
      else
        tmp_mx = max(tmp_mx, mx2 + b * v[i]);
      dp[c[i]] = max(dp[c[i]], tmp_mx);
      ans = max(ans, dp[c[i]]);
      if (idx1 == c[i])
        mx1 = max(tmp_mx, mx1);
      else if (idx2 == c[i]) {
        if (tmp_mx > mx1)
          mx2 = mx1, idx2 = idx1, mx1 = tmp_mx, idx1 = c[i];
        else
          mx2 = max(mx2, tmp_mx);
      } else if (tmp_mx > mx1)
        mx2 = mx1, idx2 = idx1, mx1 = tmp_mx, idx1 = c[i];
      else if (tmp_mx > mx2)
        mx2 = tmp_mx, idx2 = c[i];
    }
    cout << ans << '\n';
  }
  return 0;
}
