#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
const long long inf = 20000000000000ll;
int n, q;
int c[MAXN], v[MAXN], FG[MAXN];
long long a, b, VE[MAXN], hl[MAXN], hr[MAXN];
struct node {
  int col;
  long long val;
} l, r;
int main() {
  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 i = 1; i <= q; i++) {
    scanf("%I64d %I64d", &a, &b);
    for (int j = 1; j <= n; j++) VE[j] = -inf;
    l.val = 0;
    l.col = -1;
    r.val = 0;
    r.col = -2;
    for (int j = 1; j <= n; j++) {
      long long TT = VE[c[j]] + a * v[j];
      if (c[j] != l.col)
        TT = max(TT, l.val + b * v[j]);
      else
        TT = max(TT, r.val + b * v[j]);
      if (c[j] != l.col && c[j] != r.col) {
        if (TT > l.val)
          r = l, l.val = TT, l.col = c[j];
        else if (TT > r.val)
          r.val = TT, r.col = c[j];
      } else if (c[j] == l.col && TT > l.val)
        l.val = TT;
      else if (c[j] == r.col && TT > r.val)
        r.val = TT;
      if (r.val > l.val) swap(l, r);
      VE[c[j]] = max(VE[c[j]], TT);
    }
    printf("%I64d\n", l.val);
  }
  return 0;
}
