#include <bits/stdc++.h>
using namespace std;
int N, Q, v[100002], c[100002];
long long color[100002];
int col1, col2;
bitset<100002> vis;
void read() {
  scanf("%d %d", &N, &Q);
  for (int i = 0; i < N; ++i) scanf("%d", &v[i]);
  for (int i = 0; i < N; ++i) scanf("%d", &c[i]);
}
void init(int b, long long &sol) {
  col1 = col2 = 0;
  for (int i = 0; i < 100002; ++i) color[i] = -0xfffffffffffffff;
  vis.reset();
  color[c[0]] = 1LL * v[0] * b;
  sol = max(sol, color[c[0]]);
  if (color[c[0]] > 0) col1 = c[0];
  vis.set(c[0]);
}
void queries() {
  while (Q--) {
    int a, b;
    long long sol = 0;
    scanf("%d %d", &a, &b);
    init(b, sol);
    for (int i = 1; i < N; ++i) {
      if (1LL * a * v[i] > 0 && vis.test(c[i]))
        color[c[i]] = color[c[i]] + 1LL * a * v[i];
      color[c[i]] = max(color[c[i]], 1LL * b * v[i]);
      if (col1 != c[i] && vis.test(col1))
        color[c[i]] = max(color[c[i]], 1LL * b * v[i] + color[col1]);
      else if (col2 != c[i] && vis.test(col2))
        color[c[i]] = max(color[c[i]], 1LL * b * v[i] + color[col2]);
      if (color[c[i]] > color[col1]) {
        if (c[i] != col1) {
          swap(col1, col2);
          col1 = c[i];
        }
      } else if (color[c[i]] > color[col2] && col1 != c[i])
        col2 = c[i];
      sol = max(sol, color[c[i]]);
      if (!vis.test(c[i])) vis.set(c[i]);
    }
    printf("%lld\n", sol);
  }
}
int main() {
  read();
  queries();
  return 0;
}
