#include <bits/stdc++.h>
using namespace std;
long long w[100010], c[100010], dp[100010];
int vis[100010];
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int n, q, i;
  scanf("%d%d", &n, &q);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &w[i]);
  }
  for (i = 1; i <= n; i++) scanf("%I64d", &c[i]);
  int a, b;
  while (q--) {
    long long ans = -21000000000000, maxpo, tmp = 0, j;
    scanf("%d%d", &a, &b);
    for (i = 1; i <= n; i++) {
      dp[i] = -21000000000000;
    }
    dp[c[1]] = w[1] * b;
    memset(vis, 0, sizeof(vis));
    if (dp[c[1]] > ans) {
      ans = dp[c[1]], maxpo = c[1];
    }
    vis[c[1]] = 0;
    for (i = 2; i <= n; i++) {
      int color = c[i];
      if (color == maxpo) {
        dp[color] = max(dp[color], max(ans + w[i] * a, tmp + w[i] * b));
        dp[color] = max(dp[color], w[i] * b);
        ans = max(dp[color], ans);
      } else {
        dp[color] = max(dp[color], max(dp[color] + w[i] * a, ans + w[i] * b));
        dp[color] = max(dp[color], w[i] * b);
        if (dp[color] > ans) {
          tmp = ans;
          ans = dp[color];
          maxpo = color;
        } else if (dp[color] >= tmp) {
          tmp = dp[color];
        }
      }
    }
    if (ans >= 0)
      printf("%I64d\n", ans);
    else
      printf("0\n");
  }
  return 0;
}
