#include <bits/stdc++.h>
using namespace std;
int n, q, c[100010], MXL, MXH;
long long v[100010], F[100010];
char ok[100010];
inline void upd(int c, long long s) {
  if (!ok[c]) F[c] = -1ll << 50, ok[c] = 1;
  F[c] = max(F[c], s);
  if (c == MXL || c == MXH) {
    if (F[MXL] > F[MXH]) swap(MXL, MXH);
  } else {
    if (F[c] > F[MXH]) {
      MXL = MXH, MXH = c;
    } else if (F[c] > F[MXL])
      MXL = c;
  }
}
int main() {
  cin >> n >> q;
  for (int i = (int)0; i <= (int)n - 1; ++i) {
    int x;
    scanf("%d", &x);
    v[i] = x;
  }
  for (int i = (int)0; i <= (int)n - 1; ++i) scanf("%d", &c[i]);
  for (int j = (int)0; j <= (int)q - 1; ++j) {
    int a, b;
    scanf("%d%d", &a, &b);
    memset(ok, 0, sizeof(ok));
    MXL = MXH = 0;
    F[0] = 0;
    ok[0] = 1;
    for (int i = (int)0; i <= (int)n - 1; ++i) {
      long long s = F[c[i]];
      char on = ok[c[i]];
      if (MXH != c[i])
        upd(c[i], F[MXH] + v[i] * b);
      else if (MXL != c[i])
        upd(c[i], F[MXL] + v[i] * b);
      if (on) upd(c[i], s + v[i] * a);
      upd(c[i], v[i] * b);
    }
    printf("%I64d\n", F[MXH]);
  }
}
