#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 28;
const long long LINF = 1ll << 61;
inline long long getnum() {
  register long long r = 0;
  register bool ng = 0;
  register char c;
  c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') ng = 1, c = getchar();
  while (c != ' ' && c != '\n') r = r * 10 + c - '0', c = getchar();
  if (ng) r = -r;
  return r;
}
template <class T>
inline void putnum(T x) {
  if (x < 0) putchar('-'), x = -x;
  register short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
inline void putsp() { putchar(' '); }
inline void putendl() { putchar('\n'); }
inline char mygetchar() {
  register char c = getchar();
  while (c == ' ' || c == '\n') c = getchar();
  return c;
}
int n, k;
int v[100111], c[100111];
long long a[100111];
int main() {
  n = getnum(), k = getnum();
  for (int i = 1; i <= n; i++) v[i] = getnum();
  for (int i = 1; i <= n; i++) c[i] = getnum();
  while (k--) {
    long long A, B;
    A = getnum(), B = getnum();
    for (int i = 0; i <= n; i++) a[i] = -LINF;
    long long ans = 0, mx = 0, mx2 = 0;
    for (int i = 1; i <= n; i++) {
      long long tmp;
      if (mx == c[i])
        tmp = a[mx2];
      else
        tmp = a[mx];
      if (tmp < 0) tmp = 0;
      tmp = max(tmp + v[i] * B, a[c[i]] + v[i] * A);
      a[c[i]] = max(tmp, a[c[i]]);
      if (a[c[i]] >= a[mx] && c[i] != mx)
        mx2 = mx, mx = c[i];
      else if (a[c[i]] > a[mx2] && c[i] != mx)
        mx2 = c[i];
      ans = max(ans, tmp);
    }
    putnum(ans), putendl();
  }
  return 0;
}
