#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
const bool db = false;
long long v[100010], c[100010], dp[100010];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, q;
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) cin >> v[i];
  for (long long i = 1; i <= n; i++) cin >> c[i];
  for (long long k = 1; k <= q; k++) {
    long long a, b;
    cin >> a >> b;
    memset(dp, -9, sizeof(dp));
    long long same_col, dif_col, prev_col;
    same_col = dif_col = 0;
    prev_col = 0;
    for (long long i = 1; i <= n; i++) {
      if (prev_col == c[i])
        dp[c[i]] = max(dp[c[i]], max(dp[c[i]] + v[i] * a, dif_col + v[i] * b));
      else
        dp[c[i]] = max(dp[c[i]], max(dp[c[i]] + v[i] * a, same_col + v[i] * b));
      if (dp[c[i]] > same_col) {
        if (prev_col != c[i]) dif_col = same_col;
        same_col = dp[c[i]];
        prev_col = c[i];
      } else if (dp[c[i]] > dif_col && prev_col != c[i])
        dif_col = dp[c[i]];
    }
    long long ans = 0;
    for (long long i = 1; i <= n; i++) ans = max(ans, dp[i]);
    cout << ans << "\n";
  }
}
