#include <bits/stdc++.h>
using namespace std;
int n, c[100005], v[100005], A, B, m;
long long f[100005], ans;
void work() {
  int i;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &v[i]);
  for (i = 1; i <= n; i++) scanf("%d", &c[i]);
  while (m--) {
    scanf("%d%d", &A, &B);
    for (i = 1; i <= n; i++) f[i] = -1LL << 60;
    ans = 0;
    int p = 0, q = 0;
    for (i = 1; i <= n; i++) {
      long long x =
          max(f[c[i]] + (long long)A * v[i], f[q] + (long long)B * v[i]);
      if (p != c[i]) {
        x = max(x, f[p] + (long long)B * v[i]);
        if (f[p] < x)
          q = p, p = c[i];
        else if (f[q] < x)
          q = c[i];
      }
      f[c[i]] = max(f[c[i]], x);
      ans = max(f[c[i]], ans);
    }
    cout << ans << endl;
  }
}
int main() {
  work();
  return 0;
}
