#include <bits/stdc++.h>
using namespace std;
int colorIndex[100005];
long long int taking[100005];
int values[100005];
int colors[100005];
int main() {
  int n, nbQueries;
  scanf("%d%d", &n, &nbQueries);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &values[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &colors[i]);
  }
  for (int t = 0; t < nbQueries; t++) {
    int a;
    int b;
    long long int biggestColor1 = 0;
    long long int biggestColor2 = 0;
    int color1Index = -1;
    int color2Index = -1;
    scanf("%d%d", &a, &b);
    fill_n(colorIndex, n + 1, -1);
    long long int maxSerie = 0;
    for (int i = 1; i <= n; i++) {
      if (colors[i] == color1Index) {
        taking[i] = ((long long int)values[i]) * b + biggestColor2;
        if (colorIndex[colors[i]] != -1) {
          taking[i] = max(taking[i], ((long long int)values[i]) * a +
                                         taking[colorIndex[colors[i]]]);
        }
        biggestColor1 = max(biggestColor1, taking[i]);
      } else {
        taking[i] = ((long long int)values[i]) * b + biggestColor1;
        if (colorIndex[colors[i]] != -1) {
          taking[i] = max(taking[i], ((long long int)values[i]) * a +
                                         taking[colorIndex[colors[i]]]);
        }
        if (colors[i] == color2Index) {
          if (taking[i] > biggestColor2) {
            if (taking[i] > biggestColor1) {
              tie(biggestColor1, color1Index, biggestColor2, color2Index) =
                  make_tuple(taking[i], color2Index, biggestColor1,
                             color1Index);
            } else {
              biggestColor2 = taking[i];
            }
          }
        } else {
          if (taking[i] > biggestColor2) {
            if (taking[i] > biggestColor1) {
              tie(biggestColor1, color1Index, biggestColor2, color2Index) =
                  make_tuple(taking[i], colors[i], biggestColor1, color1Index);
            } else {
              biggestColor2 = taking[i];
              color2Index = colors[i];
            }
          }
        }
      }
      if (colorIndex[colors[i]] == -1 ||
          taking[colorIndex[colors[i]]] < taking[i]) {
        colorIndex[colors[i]] = i;
      }
      maxSerie = max(maxSerie, taking[i]);
    }
    printf("%I64d\n", maxSerie);
  }
  return 0;
}
