#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 100010;
int n, nq;
long long f[kMaxN], v[kMaxN];
int c[kMaxN];
long long a, b;
struct Rec {
  long long maxm;
  int col;
  Rec() {
    maxm = LONG_LONG_MIN;
    col = -1;
  }
  bool available() { return col != -1; }
};
int main() {
  cin >> n >> nq;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < nq; i++) {
    cin >> a >> b;
    for (int j = 0; j < kMaxN; j++) f[j] = LONG_LONG_MIN;
    Rec m1, m2;
    for (int j = 0; j < n; j++) {
      long long cret = v[j] * b;
      if (f[c[j]] != LONG_LONG_MIN) {
        cret = ((cret) > (f[c[j]] + v[j] * a) ? (cret) : (f[c[j]] + v[j] * a));
      }
      if (m1.available()) {
        if (m1.col != c[j]) {
          cret =
              ((cret) > (m1.maxm + v[j] * b) ? (cret) : (m1.maxm + v[j] * b));
        } else if (m2.available()) {
          cret =
              ((cret) > (m2.maxm + v[j] * b) ? (cret) : (m2.maxm + v[j] * b));
        }
      }
      if (cret > m1.maxm) {
        if (m1.col == c[j])
          m1.maxm = cret;
        else {
          m2 = m1;
          m1.maxm = cret;
          m1.col = c[j];
        }
      } else if (cret > m2.maxm && c[j] != m1.col) {
        m2.maxm = cret;
        m2.col = c[j];
      }
      f[c[j]] = ((f[c[j]]) > (cret) ? (f[c[j]]) : (cret));
    }
    cout << ((m1.maxm) > (0) ? (m1.maxm) : (0)) << endl;
  }
  return 0;
}
