#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
const long long INF = 100000000000000000LL;
int v[N], c[N];
long long f[N];
bool s[N];
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) cin >> v[i];
  for (int i = 1; i <= n; ++i) cin >> c[i];
  for (int i = 0; i < q; ++i) {
    int a, b;
    cin >> a >> b;
    for (int j = 1; j < N; ++j) f[j] = -INF, s[j] = false;
    int Max = 1, Max2 = 2;
    for (int j = 1; j <= n; ++j) {
      f[c[j]] =
          max(f[c[j]],
              max((s[c[j]] ? 1LL * a * v[j] + f[c[j]] : -INF),
                  1LL * b * v[j] + max(0LL, (Max == c[j] ? f[Max2] : f[Max]))));
      s[c[j]] = true;
      long long val = f[c[j]];
      if (val >= f[Max]) {
        if (Max != c[j]) {
          Max2 = Max;
          Max = c[j];
        }
      } else if (val > f[Max2]) {
        Max2 = c[j];
      }
    }
    cout << max(0LL, f[Max]) << '\n';
  }
  return 0;
}
