#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
long long n, m;
long long v[111111], c[111111], dp[111111];
int main() {
  long long i, j, k, x, y, z, ca = 1, re = 0;
  scanf("%I64d%I64d", &(n), &(m));
  for (int i = (int)(1); i <= (int)(n); ++i) scanf("%I64d", &(v[i]));
  for (int i = (int)(1); i <= (int)(n); ++i) scanf("%I64d", &(c[i]));
  while (m--) {
    for (int i = (int)(1); i <= (int)(111111 - 1); ++i) dp[i] = -(1ll << 60);
    scanf("%I64d%I64d", &(x), &(y));
    long long m1 = 0, m2 = 0, id1 = 0, id2 = 0;
    dp[c[1]] = v[1] * y;
    if (dp[c[1]] >= 0) {
      m1 = dp[c[1]], id1 = c[1];
    } else
      m2 = dp[c[1]], id2 = c[1];
    for (int i = (int)(2); i <= (int)(n); ++i) {
      if (id1 == c[i]) {
        if (dp[c[i]] == -(1ll << 60)) {
          dp[c[i]] = m1 + v[i] * y;
        } else {
          dp[c[i]] = max(dp[c[i]], max(dp[c[i]] + v[i] * x, m2 + v[i] * y));
        }
      } else {
        if (dp[c[i]] == -(1ll << 60)) {
          dp[c[i]] = m1 + v[i] * y;
        } else {
          dp[c[i]] = max(dp[c[i]], max(m1 + v[i] * y, dp[c[i]] + v[i] * x));
        }
      }
      if (dp[c[i]] >= m1 && id1 != c[i]) {
        m2 = m1, id2 = id1;
        m1 = dp[c[i]], id1 = c[i];
      } else if (dp[c[i]] >= m1 && id1 == c[i]) {
        m1 = dp[c[i]];
      } else if (dp[c[i]] >= m2) {
        m2 = dp[c[i]], id2 = c[i];
      }
    }
    re = 0;
    for (int i = (int)(1); i <= (int)(111111 - 1); ++i) re = max(re, dp[i]);
    printf("%I64d\n", (re));
  }
  return 0;
}
