#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:255000000")
bool firstout = 1;
template <class T>
T &minn(T &a, T b) {
  if (b < a) a = b;
  return a;
}
template <class T>
T &maxx(T &a, T b) {
  if (a < b) a = b;
  return a;
}
int &madd(int &a, int b) {
  a += b;
  if (a >= 1000000009) a -= 1000000009;
  return a;
}
int &msub(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000009;
  return a;
}
int &mmult(int &a, int b) { return a = (long long)a * b % 1000000009; }
int mdiv(long long a, long long b, long long m) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  if (a % b == 0) return a / b;
  return (a + m * mdiv(-a, m, b)) / b;
}
int n, m, q;
int A[101234];
int B[101234];
long long D[101234];
int main() {
  int i, j, k;
  char c;
  int a, d;
  int ts;
  for (ts = 1; scanf("%"
                     "d",
                     &(n)) > 0;
       ++ts) {
    scanf(
        "%"
        "d",
        &(q));
    for (i = (0); i < (n); ++i) {
      scanf(
          "%"
          "d",
          &(A[i]));
    }
    for (i = (0); i < (n); ++i) {
      scanf(
          "%"
          "d",
          &(B[i]));
      --B[i];
    }
    for (; q--;) {
      long long a, b;
      scanf(
          "%"
          "I64d",
          &(a));
      scanf(
          "%"
          "I64d",
          &(b));
      for (i = (0); i < (101234); ++i)
        D[i] = -(long long)1012345678 * 1012345678;
      long long mx = 0, mxx = 0;
      int c = 0;
      for (i = (0); i < (n); ++i) {
        long long x;
        j = B[i];
        if (c == j) {
          x = (long long)b * A[i] + mxx;
          maxx(x, (long long)a * A[i] + D[j]);
          maxx(mx, x);
        } else {
          x = (long long)b * A[i] + mx;
          maxx(x, (long long)a * A[i] + D[j]);
          if (x > mx) {
            mxx = mx;
            mx = x;
            c = B[i];
          } else
            maxx(mxx, x);
        }
        maxx(D[j], x);
      }
      long long res = mx;
      printf((firstout) ? "%"
                          "I64d"
                        : " %"
                          "I64d",
             (res)),
          firstout = 0;
      printf("\n"), firstout = 1;
    }
  }
  return 0;
}
