#include <bits/stdc++.h>
using namespace std;
long long v[100006], f[100006], Fmax, Fmaxc;
long c[100006], dmax;
long long ans, k, a, b;
int main() {
  std::ios::sync_with_stdio(false);
  long i, j, m, n;
  cin >> n >> m;
  for (i = 1; i <= n; ++i) cin >> v[i];
  for (i = 1; i <= n; ++i) cin >> c[i];
  while (--m >= 0) {
    cin >> a >> b;
    for (i = 1; i <= n; ++i) f[i] = -1000000000000006LL;
    Fmax = Fmaxc = -1000000000000006LL;
    dmax = 1;
    ans = 0LL;
    for (i = 1; i <= n; ++i) {
      k = v[i] * b;
      k = max(k, f[c[i]] + v[i] * a);
      if (dmax == c[i])
        k = max(k, Fmaxc + v[i] * b);
      else
        k = max(k, Fmax + v[i] * b);
      ans = max(ans, k);
      f[c[i]] = max(f[c[i]], k);
      if (dmax == c[i]) {
        Fmax = max(Fmax, f[c[i]]);
      } else {
        if (f[c[i]] > Fmax) {
          Fmaxc = Fmax;
          Fmax = f[c[i]];
          dmax = c[i];
        } else if (f[c[i]] > Fmaxc)
          Fmaxc = f[c[i]];
      }
    }
    cout << ans << endl;
  }
  return 0;
}
