#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
const long long oo = 1e17;
int n, q, v[N], c[N];
long long dp[N], mx[N];
int main(int argc, char **argv) {
  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]);
    --c[i];
  }
  while (q--) {
    long long a, b, res = 0;
    scanf("%lld%lld", &a, &b);
    for (int i = 0; i < n; ++i) dp[i] = mx[i] = -oo;
    pair<long long, int> b1 = make_pair(dp[0], -1), b2 = make_pair(dp[0], -1);
    for (int i = 0; i < n; ++i) {
      dp[i] = max(dp[i], v[i] * b);
      if (mx[c[i]] != -oo) dp[i] = max(dp[i], mx[c[i]] + v[i] * a);
      if (b1.second != -1) {
        if (b1.second == c[i] && b2.second != -1)
          dp[i] = max(dp[i], b2.first + v[i] * b);
        else if (b1.second != c[i])
          dp[i] = max(dp[i], b1.first + v[i] * b);
      }
      mx[c[i]] = max(mx[c[i]], dp[i]);
      if (b1.second == -1 || dp[i] > b1.first) {
        if (b1.second != c[i]) b2 = b1;
        b1 = make_pair(dp[i], c[i]);
      } else if (c[i] != b1.second && (b2.second == -1 || dp[i] > b2.first))
        b2 = make_pair(dp[i], c[i]);
      res = max(res, dp[i]);
    }
    printf("%lld\n", res);
  }
  return 0;
}
