#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, q;
  cin >> n >> q;
  long long v[n], c[n];
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < n; i++) {
    cin >> c[i];
    c[i]--;
  }
  while (q--) {
    long long a, b;
    cin >> a >> b;
    vector<long long> dp(n + 1, -1e18);
    dp[n] = 0;
    long long ma = 0, m1 = n, m2 = n;
    for (long long i = 0; i < n; i++) {
      long long g;
      if (m1 == c[i])
        g = m2;
      else
        g = m1;
      if (dp[c[i]] != -1e18) {
        long long x = dp[g] + v[i] * b;
        long long y = max(dp[c[i]], dp[c[i]] + v[i] * a);
        x = max(x, y);
        ma = max(x, ma);
        dp[c[i]] = x;
        if (x > dp[m1]) {
          m2 = m1;
          m1 = c[i];
        } else if (x > dp[m2] && c[i] != m1) {
          m2 = c[i];
        }
      } else {
        long long x = dp[g] + v[i] * b;
        ma = max(x, ma);
        dp[c[i]] = x;
        if (x > dp[m1]) {
          m2 = m1;
          m1 = c[i];
        } else if (x > dp[m2] && c[i] != m1) {
          m2 = c[i];
        }
      }
    }
    cout << ma << endl;
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
