#include <bits/stdc++.h>
using namespace std;
const int TAM = 1e5 + 10;
int c[TAM];
int v[TAM];
long long dp[TAM];
int n;
pair<int, long long> b1, b2;
void ins(pair<int, long long> ot) {
  if (ot.first == b1.first) {
    b1.second = max(b1.second, ot.second);
  } else if (ot.first == b2.first) {
    b2.second = max(b2.second, ot.second);
    if (b2.second > b1.second) swap(b1, b2);
  } else {
    if (ot.second >= b1.second) {
      swap(b1, b2);
      b1 = ot;
    } else if (ot.second >= b2.second) {
      b2 = ot;
    }
  }
}
int main() {
  int q;
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  int a, b;
  while (q--) {
    long long ans = 0;
    scanf("%d %d", &a, &b);
    for (int i = 0; i <= n; i++) dp[i] = (long long)-1e17;
    b1 = {-1, 0}, b2 = {-2, 0};
    for (int i = 0; i < n; i++) {
      long long tmp = (long long)-1e17;
      if (c[i] != b1.first) tmp = max(tmp, b1.second + 1LL * b * v[i]);
      if (c[i] != b2.first) tmp = max(tmp, b2.second + 1LL * b * v[i]);
      tmp = max(tmp, dp[c[i]] + 1LL * a * v[i]);
      dp[c[i]] = max(dp[c[i]], tmp);
      ins({c[i], dp[c[i]]});
      ans = max(dp[c[i]], ans);
    }
    cout << ans << endl;
  }
  return 0;
}
