#include <bits/stdc++.h>
using namespace std;
int n, q, C[100010], V[100010], MXL, MXH;
long long F[100010];
char ok[100010];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = (int)0; i <= (int)n - 1; ++i) scanf("%d", V + i);
  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) {
      int c = C[i];
      long long v = V[i];
      long long sum = -1ll << 50;
      if (MXH != c) {
        if (F[MXH] + v * b > sum) sum = F[MXH] + v * b;
      } else if (MXL != c) {
        if (F[MXL] + v * b > sum) sum = F[MXL] + v * b;
      }
      if (ok[c]) {
        if (F[c] + v * a > sum) sum = F[c] + v * a;
      }
      if (v * b > sum) sum = v * b;
      if (!ok[c]) F[c] = -1ll << 50, ok[c] = 1;
      if (sum > F[c]) {
        F[c] = sum;
        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;
        }
      }
    }
    printf("%I64d\n", F[MXH]);
  }
}
