#include <bits/stdc++.h>
using namespace std;
int const MAXN = 1e5 + 10;
int n, m, c[MAXN], x, y;
long long v[MAXN], a, b, dp[MAXN], ans;
long long custo(int c1, int c2, int i) {
  if (c1 == c2) return v[i] * a;
  return v[i] * b;
}
int main() {
  cin.sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  while (m--) {
    x = 0;
    y = 0;
    ans = 0;
    cin >> a >> b;
    for (int i = 0; i <= n; i++) dp[i] = -1e18;
    for (int i = 1; i <= n; i++) {
      if (dp[c[x]] < dp[c[y]]) swap(x, y);
      long long cost = v[i] * b;
      if (dp[c[i]] != -1e18) cost = max(cost, dp[c[i]] + v[i] * a);
      cost = max(cost, max(dp[c[x]] + custo(c[i], c[x], i),
                           dp[c[y]] + custo(c[i], c[y], i)));
      dp[c[i]] = max(dp[c[i]], cost);
      if (dp[c[i]] > dp[c[x]]) {
        if (c[x] == c[i])
          x = i;
        else
          y = x, x = i;
      } else if (dp[c[i]] > dp[c[y]]) {
        if (c[x] == c[i])
          continue;
        else
          y = i;
      }
    }
    for (int i = 1; i <= n; i++) ans = max(ans, dp[i]);
    cout << ans << endl;
  }
  return 0;
}
