#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1LL << 56;
long long int read() {
  int x;
  scanf("%d", &x);
  return 1LL * x;
}
int n, q, c[100010];
long long int v[100010], dp[100010];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) v[i] = read();
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  while (q--) {
    long long int a = read(), b = read();
    long long int ans = 0;
    int Max = 0, Nxt = 0;
    for (int i = 0; i <= n; i++) dp[i] = -INF;
    for (int i = 1; i <= n; i++) {
      int color = c[i];
      long long int now = max(dp[color] + a * v[i], b * v[i]);
      if (color != Max)
        now = max(now, dp[Max] + b * v[i]);
      else
        now = max(now, dp[Nxt] + b * v[i]);
      if (now > dp[Max]) {
        if (Max != color) Nxt = Max, Max = color;
      } else if (now > dp[Nxt] && color != Max)
        Nxt = color;
      dp[color] = max(dp[color], now);
      ans = max(ans, now);
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
