#include <bits/stdc++.h>
using namespace std;
int c[100001];
int v[100001];
int n;
long long a, b;
long long dp[100001];
int main() {
  int q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  while (q-- > 0) {
    cin >> a >> b;
    for (int i = 1; i <= n; i++) dp[i] = -1e14;
    int first = 0, second = 0;
    for (int i = 1; i <= n; i++) {
      if (c[i] == first) {
        dp[first] = max(dp[first], dp[first] + v[i] * a);
        dp[first] = max(dp[first], dp[second] + v[i] * b);
      } else if (c[i] == second) {
        dp[second] = max(dp[second], dp[second] + v[i] * a);
        dp[second] = max(dp[second], dp[first] + v[i] * b);
        if (dp[first] <= dp[second]) {
          swap(first, second);
        }
      } else {
        dp[c[i]] = max(dp[c[i]], dp[c[i]] + v[i] * a);
        dp[c[i]] = max(dp[c[i]], dp[first] + v[i] * b);
        if (dp[c[i]] >= dp[second]) {
          second = c[i];
        }
        if (dp[first] <= dp[second]) {
          swap(first, second);
        }
      }
    }
    long long ans = 0;
    for (int i = 0; i <= n; i++) {
      ans = max(ans, dp[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
