#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const long long int mod = 1e9 + 7;
const long long int inf = 1e16;
const int MAXN = 1e5 + 5;
int colour[MAXN], value[MAXN];
vector<pair<long long int, int>> top(3);
long long int lastval[MAXN];
void cp() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> value[i];
  for (int i = 0; i < n; i++) cin >> colour[i], colour[i]--;
  while (q--) {
    long long int a, b;
    cin >> a >> b;
    long long int best = 0;
    top[0] = top[1] = top[2] = make_pair(-inf, -1);
    for (int i = 0; i < n; i++) lastval[i] = -inf;
    for (int i = 0; i < n; i++) {
      long long int same = lastval[colour[i]] + a * value[i];
      long long int other = 0;
      if (top[0].second != colour[i]) other = max(other, top[0].first);
      if (top[1].second != colour[i]) other = max(other, top[1].first);
      other += b * value[i];
      long long int me = max(same, other);
      best = max(best, me);
      lastval[colour[i]] = max(lastval[colour[i]], me);
      bool found = false;
      if (top[0].second == colour[i])
        top[0].first = max(me, top[0].first);
      else if (top[1].second == colour[i])
        top[1].first = max(me, top[1].first);
      else
        top[2] = {me, colour[i]};
      sort(top.rbegin(), top.rend());
    }
    cout << best << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    cp();
  }
  return 0;
}
