#include <bits/stdc++.h>
using namespace std;
const int MAX = 100 * 1000 + 10;
const long long INF = 1000 * 1000 * 10, INFI = INF * INF;
long long n, q, v[MAX], c[MAX], rang[MAX];
pair<long long, long long> maxi[2];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = (int)0; i < (int)n; i++) cin >> v[i];
  for (int i = (int)0; i < (int)n; i++) {
    cin >> c[i];
    c[i]--;
  }
  for (int i = (int)0; i < (int)q; i++) {
    long long a, b;
    cin >> a >> b;
    fill(rang, rang + n, -INFI);
    fill(maxi, maxi + 2, make_pair(0, -1));
    for (int i = (int)0; i < (int)n; i++) {
      long long miad = rang[c[i]] + v[i] * a;
      if (maxi[0].second == c[i])
        miad = max(miad, max((long long)0, maxi[1].first) + v[i] * b);
      else
        miad = max(miad, max((long long)0, maxi[0].first) + v[i] * b);
      if (miad > maxi[0].first) {
        if (maxi[0].second != c[i]) maxi[1] = maxi[0];
        maxi[0] = make_pair(miad, c[i]);
      } else if (miad > maxi[1].first) {
        if (maxi[0].second != c[i]) maxi[1] = make_pair(miad, c[i]);
      }
      rang[c[i]] = max(rang[c[i]], miad);
    }
    cout << maxi[0].first << endl;
  }
}
