#include <bits/stdc++.h>
using namespace std;
long long dp[100010], temp;
int main(void) {
  int i, j, k, l;
  long long c[100010], v[100010];
  int n, q;
  long long mx, mmax;
  long long a, b;
  bool vs[100010];
  while (scanf("%d %d", &n, &q) != EOF) {
    for (i = 1; i <= n; i++) scanf("%I64d", &v[i]);
    for (i = 1; i <= n; i++) {
      scanf("%I64d", &c[i]);
    }
    c[0] = 0;
    for (i = 1; i <= q; i++) {
      scanf("%I64d %I64d", &a, &b);
      memset(dp, -1, sizeof(dp));
      for (j = 1; j <= n; j++) vs[j] = false;
      dp[0] = -9223372036854775808;
      int id1 = 0, id2 = 0;
      for (j = 1; j <= n; j++) {
        int id = c[j];
        mx = dp[id];
        mmax = (id == id1) ? dp[id2] : dp[id1];
        if (!vs[id]) {
          dp[id] = max(0ll, mmax) + b * v[j];
          vs[id] = true;
        } else
          dp[id] = max(dp[id], max(mx + a * v[j], max(0ll, mmax) + b * v[j]));
        if (dp[id] >= dp[id1]) {
          if (id != id1) id2 = id1;
          id1 = id;
        } else if (dp[id] >= dp[id2])
          id2 = id;
      }
      printf("%I64d\n", max(0ll, dp[id1]));
    }
  }
  return 0;
}
