#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long v[N], c[N];
long long dp[N];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, 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--) {
    long long a, b;
    cin >> a >> b;
    long long m1 = 0, m2 = 0;
    for (int i = 1; i <= n; i++) dp[i] = LLONG_MIN;
    for (int i = 1; i <= n; i++) {
      long long &cc = c[i], &vv = v[i];
      long long temp = b * vv;
      if (dp[cc] > LLONG_MIN) temp = max(temp, dp[cc] + a * vv);
      if (m1 != cc) {
        temp = max(temp, dp[m1] + b * vv);
      } else if (m2 != cc) {
        temp = max(temp, dp[m2] + b * vv);
      }
      if (dp[cc] < temp) {
        dp[cc] = temp;
        if (dp[m1] < dp[cc]) {
          m2 = m1, m1 = cc;
        } else if (dp[m2] < dp[cc] && cc != m1) {
          m2 = cc;
        }
      }
    }
    cout << dp[m1] << "\n";
  }
  return 0;
}
