#include <bits/stdc++.h>
using namespace std;
int n, q;
int v[100005], c[100005];
long long dp[100005][2];
int main() {
  ios::sync_with_stdio(false);
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", v + i);
  for (int i = 0; i < n; i++) scanf("%d", c + i);
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    for (int color = 1; color <= n; color++) dp[color][0] = 0, dp[color][1] = 0;
    int c1 = 1, c2 = 2;
    for (int i = n - 1; i >= 0; i--) {
      int color = c[i];
      long long val1 = dp[color][0];
      long long val2 = dp[c1][1];
      if (c1 == color) val2 = dp[c2][1];
      dp[color][0] = max(dp[color][0], max(val1, val2) + a * 1LL * v[i]);
      dp[color][1] = max(dp[color][1], max(val1, val2) + b * 1LL * v[i]);
      if (c1 != color && c2 != color) {
        if (dp[color][1] >= dp[c1][1]) {
          c2 = c1;
          c1 = color;
        } else if (dp[color][1] > dp[c2][1])
          c2 = color;
      } else if (c2 == color)
        if (dp[color][1] > dp[c1][1]) swap(c1, c2);
    }
    cout << dp[c1][1] << endl;
  }
  return 0;
}
