#include <bits/stdc++.h>
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
using namespace std;
const int N = 100010;
int v[N], c[N];
long long dp[N];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", v + i);
  for (int i = 1; i <= n; i++) scanf("%d", c + i);
  for (int k = 1; k <= q; k++) {
    memset(dp, 0x80, sizeof(dp));
    long long a, b;
    int f = 0, s = 0;
    scanf("%I64d%I64d", &a, &b);
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
      dp[c[i]] = max(dp[c[i]] + v[i] * a, dp[c[i]]);
      if (f != c[i])
        dp[c[i]] = max(dp[c[i]], dp[f] + v[i] * b);
      else
        dp[c[i]] = max(dp[c[i]], dp[s] + v[i] * b);
      if (c[i] == f && dp[c[i]] > dp[f]) f = c[i];
      if (c[i] == s && dp[c[i]] > dp[s]) s = c[i];
      if (c[i] != f && c[i] != s) {
        if (dp[c[i]] > dp[f])
          s = f, f = c[i];
        else if (dp[c[i]] > dp[s])
          s = c[i];
      }
      if (dp[f] < dp[s]) swap(s, f);
    }
    cout << dp[f] << endl;
  }
  return 0;
}
