#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int n_ = 1e5 + 5;
int n, q, c[n_], v[n_], vis[n_], visID;
long long a, b, x, xid, y, yid, dp[n_];
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  while (q--) {
    ++visID;
    scanf("%lld %lld", &a, &b);
    x = y = -1e9;
    xid = yid = -1;
    for (int i = 0; i < n; i++) {
      if (vis[c[i]] != visID) {
        vis[c[i]] = visID;
        dp[c[i]] = v[i] * b;
        if (xid != -1) dp[c[i]] = max(dp[c[i]], x + v[i] * b);
      } else {
        dp[c[i]] = max(dp[c[i]] + v[i] * a, dp[c[i]]);
        dp[c[i]] = max(v[i] * b, dp[c[i]]);
        if (xid != -1 && xid != c[i]) dp[c[i]] = max(dp[c[i]], x + v[i] * b);
        if (yid != -1 && yid != c[i]) dp[c[i]] = max(dp[c[i]], y + v[i] * b);
      }
      if (xid == c[i])
        x = dp[c[i]];
      else if (x < dp[c[i]]) {
        y = x;
        yid = xid;
        x = dp[c[i]];
        xid = c[i];
      } else if (yid == c[i])
        y = dp[c[i]];
      else if (y < dp[c[i]]) {
        y = dp[c[i]];
        yid = c[i];
      }
    }
    printf("%lld\n", max(0ll, x));
  }
  return 0;
}
