#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  int v[n];
  int c[n];
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    c[i]--;
  }
  while (q--) {
    int a, b;
    cin >> a >> b;
    long long dp[n];
    for (int i = 0; i < n; i++) dp[i] = -1LL << 60;
    long long res = 0;
    long long mx1 = -1LL << 60, mx2 = -1LL << 60;
    unordered_set<int> s;
    long long c1 = -1;
    for (int i = 0; i < n; i++) {
      long long t = dp[c[i]];
      dp[c[i]] = max(b * 1LL * v[i], t + a * 1LL * v[i]);
      if (c1 == c[i]) {
        dp[c[i]] = max(dp[c[i]], mx2 + b * 1LL * v[i]);
      } else {
        dp[c[i]] = max(dp[c[i]], mx1 + b * 1LL * v[i]);
      }
      dp[c[i]] = max(dp[c[i]], t);
      if (mx1 < dp[c[i]]) {
        if (c1 != c[i]) {
          mx2 = mx1;
        }
        mx1 = dp[c[i]];
        c1 = c[i];
      } else if (mx2 < dp[c[i]] && c1 != c[i]) {
        mx2 = dp[c[i]];
      }
      res = max(res, dp[c[i]]);
    }
    cout << res << endl;
  }
  return 0;
}
