#include <bits/stdc++.h>
using namespace std;
template <typename T>
void getmin(T &a, T b) {
  if (a > b) a = b;
}
template <typename T>
void getmax(T &a, T b) {
  if (a < b) a = b;
}
const int MAXN = 100010;
const int MAXC = 100010;
long long v[MAXN];
int c[MAXN];
int used[MAXN];
long long dp[MAXC];
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = (0); i <= ((int)n - 1); i++) scanf("%I64d", &v[i]);
  for (int i = (0); i <= ((int)n - 1); i++) scanf("%d", &c[i]);
  long long a, b;
  while (q--) {
    scanf("%I64d %I64d", &a, &b);
    memset(dp, -1, sizeof dp);
    memset(used, 0, sizeof used);
    long long ans = -1000000000000LL, ans2 = -1000000000000LL, t;
    int cans = -1, cans2 = -1;
    for (int i = (0); i <= ((int)n - 1); i++) {
      t = max(b * v[i], b * v[i] + (c[i] == cans ? ans2 : ans));
      if (used[c[i]]) {
        if (dp[c[i]] + a * v[i] > t) t = dp[c[i]] + a * v[i];
      }
      if (!used[c[i]])
        dp[c[i]] = t;
      else
        dp[c[i]] = max(dp[c[i]], t);
      used[c[i]] = 1;
      if (t > ans) {
        if (c[i] != cans) {
          ans2 = ans;
          cans2 = cans;
        }
        ans = t;
        cans = c[i];
      } else if (t > ans2 && cans != c[i]) {
        ans2 = t;
        cans2 = c[i];
      }
    }
    printf("%I64d\n", max(0LL, ans));
  }
  return 0;
}
