#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793238462643383279;
const long double EPS = 1e-6;
const long long INF = 1e18 + 7;
const long long MOD = INF;
const long long maxn = 1e5 + 2;
const long long HASH_MODS[] = {1000000007333, 1000000009367, 1000000075747,
                               1000000158923, 1000000203119};
long long c[maxn];
long long v[maxn];
long long dp[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, q;
  cin >> n >> q;
  for (int i = (1); i < (n + 1); ++i) {
    cin >> v[i];
  }
  for (int i = (1); i < (n + 1); ++i) {
    cin >> c[i];
  }
  while (q--) {
    int a, b;
    cin >> a >> b;
    int cmx1 = 0;
    int cmx2 = 0;
    long long mx1 = 0;
    long long mx2 = 0;
    for (int i = 1; i <= n; ++i) dp[i] = -INF;
    for (int i = 1; i <= n; ++i) {
      dp[c[i]] = max(dp[c[i]], dp[c[i]] + v[i] * a);
      if (c[i] != cmx1) dp[c[i]] = max(dp[c[i]], mx1 + v[i] * b);
      if (c[i] != cmx2) dp[c[i]] = max(dp[c[i]], mx2 + v[i] * b);
      if (dp[c[i]] >= mx1) {
        if (cmx1 != c[i]) {
          cmx2 = cmx1;
          mx2 = mx1;
        }
        mx1 = dp[c[i]];
        cmx1 = c[i];
      } else if (dp[c[i]] > mx2) {
        if (cmx1 != c[i]) cmx2 = c[i], mx2 = dp[c[i]];
      }
    }
    long long ans = 0;
    for (int i = (1); i < (n + 1); ++i) ans = max(ans, dp[i]);
    cout << ans << "\n";
  }
}
