#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
int n, q;
long long v[MAX], c[MAX], dp[MAX];
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &v[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &c[i]);
  }
  while (q--) {
    int a, b;
    scanf("%d %d", &a, &b);
    for (int i = 1; i <= n; i++) dp[i] = (long long)-1e16;
    int ca = 0, cb = 0;
    long long res = 0;
    for (int i = 1; i <= n; i++) {
      res = max(dp[c[i]] + v[i] * a, dp[cb] + v[i] * b);
      if (ca != c[i]) {
        res = max(res, dp[ca] + v[i] * b);
        if (dp[ca] < res)
          cb = ca, ca = c[i];
        else if (dp[cb] < res)
          cb = c[i];
      }
      dp[c[i]] = max(dp[c[i]], res);
    }
    printf("%I64d\n", dp[ca]);
  }
  return 0;
}
