#include <bits/stdc++.h>
using namespace std;
long long v[100005], c[100005], dp[100005];
int n, q;
void solve() {
  long long mx1 = -1e15, mx2 = -1e15;
  for (int i = 1; i <= n; ++i) dp[i] = -1e15;
  long long a, b;
  scanf("%lld%lld", &a, &b);
  for (int i = 1; i <= n; ++i) {
    if (dp[c[i]] == mx1) {
      dp[c[i]] = max(dp[c[i]], max(v[i] * b, dp[c[i]] + v[i] * a));
      dp[c[i]] = max(dp[c[i]], mx2 + v[i] * b);
      mx1 = dp[c[i]];
    } else {
      dp[c[i]] = max(dp[c[i]], max(v[i] * b, dp[c[i]] + v[i] * a));
      dp[c[i]] = max(dp[c[i]], mx1 + v[i] * b);
      if (dp[c[i]] > mx1)
        mx2 = mx1, mx1 = dp[c[i]];
      else if (dp[c[i]] > mx2)
        mx2 = dp[c[i]];
    }
  }
  printf("%lld\n", max(mx1, (long long)0));
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%lld", &v[i]);
  for (int i = 1; i <= n; ++i) scanf("%lld", &c[i]);
  while (q--) solve();
  return 0;
}
