#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int M = 505;
long long val[N], col[N], dp[N], maxi[N];
int n;
int maxi1, maxi2;
long long solve(long long a, long long b) {
  memset(dp, 0, sizeof dp);
  memset(maxi, 0, sizeof maxi);
  maxi1 = -1, maxi2 = -1;
  long long res = 0;
  for (int i = n - 1; i >= 0; i--) {
    long long nxt_same, nxt_diff;
    nxt_same = dp[col[i]];
    if (maxi1 != -1 && maxi1 != col[i])
      nxt_diff = maxi[maxi1];
    else if (maxi2 != -1 && maxi2 != col[i])
      nxt_diff = maxi[maxi2];
    else
      nxt_diff = 0;
    long long cur = max(nxt_same, nxt_diff);
    dp[col[i]] = max(dp[col[i]], cur + val[i] * a);
    long long diff = cur + val[i] * b;
    maxi[col[i]] = max(maxi[col[i]], diff);
    res = max(res, maxi[col[i]]);
    if (maxi1 == col[i] || maxi2 == col[i]) {
      if (maxi2 != -1 && maxi[maxi2] > maxi[maxi1]) swap(maxi1, maxi2);
      continue;
    }
    if (maxi1 == -1)
      maxi1 = col[i];
    else if (maxi2 == -1) {
      maxi2 = col[i];
      if (maxi[maxi2] > maxi[maxi1]) swap(maxi1, maxi2);
    } else if (maxi[col[i]] > maxi[maxi1]) {
      maxi2 = maxi1;
      maxi1 = col[i];
    } else if (maxi[col[i]] > maxi[maxi2])
      maxi2 = col[i];
  }
  return res;
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%I64d", &val[i]);
  for (int i = 0; i < n; i++) scanf("%I64d", &col[i]), col[i]--;
  for (int i = 0; i < q; i++) {
    long long a, b;
    scanf("%I64d%I64d", &a, &b);
    printf("%I64d\n", solve(a, b));
  }
}
