#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;
const int INF = 1001001001;
const ll mod = 998244353;
const ll INFL = 1000000001000000000;
int M = 100005;
int main() {
  int n, q;
  cin >> n >> q;
  vector<ll> v(n);
  for (int i = 0; i < (n); i++) cin >> v[i];
  vector<int> c(n);
  for (int i = 0; i < (n); i++) cin >> c[i];
  for (int i = 0; i < (n); i++) c[i]--;
  while (q--) {
    ll a, b;
    cin >> a >> b;
    vector<ll> dp(M, -INFL);
    ll bigM1 = 0, bigM2 = 0;
    int bigC1 = -1, bigC2 = -1;
    for (int i = 0; i < (n); i++) {
      if (c[i] == bigC1) {
        ll nM = max(dp[c[i]] + v[i] * a, bigM2 + v[i] * b);
        dp[c[i]] = max(dp[c[i]], nM);
        if (bigM1 < nM) {
          bigM1 = nM;
          bigC1 = c[i];
        }
      } else {
        ll nM = max(dp[c[i]] + v[i] * a, bigM1 + v[i] * b);
        dp[c[i]] = max(dp[c[i]], nM);
        if (bigM2 < nM) {
          bigM2 = nM;
          bigC2 = c[i];
        }
        if (bigM1 < bigM2) {
          swap(bigM1, bigM2);
          swap(bigC1, bigC2);
        }
      }
    }
    ll ans = 0;
    for (int i = 0; i < (M); i++) ans = max(ans, dp[i]);
    printf("%lld\n", ans);
  }
  return 0;
}
