#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 55;
long long dp[N];
long long v[N];
long long c[N];
long long a[N];
int main() {
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  long long best1, best2;
  long long x, y;
  int c1;
  while (q--) {
    cin >> x >> y;
    for (int i = 1; i < N; i++) a[i] = -1e17;
    best1 = -1e17;
    best2 = -1e17;
    c1 = -1;
    for (int i = 0; i < n; i++) {
      dp[i] = v[i] * y;
      dp[i] = max(dp[i], a[c[i]] + v[i] * x);
      if (c1 != -1 && c1 != c[i]) {
        dp[i] = max(dp[i], best1 + v[i] * y);
      } else if (c1 == c[i]) {
        dp[i] = max(dp[i], best2 + v[i] * y);
      }
      if (dp[i] > best1) {
        if (c1 == c[i])
          best1 = dp[i];
        else {
          best2 = best1;
          best1 = dp[i];
          c1 = c[i];
        }
      }
      if (dp[i] > best2 && c1 != c[i]) best2 = dp[i];
      a[c[i]] = max(dp[i], a[c[i]]);
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) ans = max(ans, dp[i]);
    cout << ans << endl;
  }
  return 0;
}
