#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 11;
int c[N], n, q;
long long v[N], a, b, dp[N], ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  while (q) {
    cin >> a >> b;
    fill_n(dp, N, -1e18);
    int maxind1 = 0, maxind2 = -1;
    long long mel1 = 0, mel2 = -1;
    for (int i = 0; i < n; i++) {
      long long gmax;
      if (maxind1 == c[i])
        gmax = mel2;
      else
        gmax = mel1;
      long long ans1 = dp[c[i]] + (1LL * v[i] * a),
                ans2 = gmax + (1LL * v[i] * b);
      dp[c[i]] = max(max(dp[c[i]], ans1), ans2);
      if (maxind1 == c[i])
        mel1 = dp[c[i]];
      else if (dp[c[i]] >= mel1) {
        maxind2 = maxind1;
        maxind1 = c[i];
        mel2 = mel1;
        mel1 = dp[c[i]];
      } else if (dp[c[i]] >= mel2) {
        maxind2 = c[i];
        mel2 = dp[c[i]];
      }
    }
    cout << mel1 << '\n';
    q--;
  }
}
