#include <bits/stdc++.h>
using namespace std;
long long n, q, c[100005], v[100005], f[100005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  while (q--) {
    long long a, b, ans = 0, mx = 0, smx = 0;
    memset(f, -6, sizeof(f));
    cin >> a >> b;
    for (int i = 1; i <= n; i++) {
      long long cur = max(v[i] * b, f[c[i]] + v[i] * a);
      if (c[i] != mx)
        cur = max(cur, f[mx] + v[i] * b);
      else
        cur = max(cur, f[smx] + v[i] * b);
      if (cur > f[mx]) {
        if (mx != c[i]) smx = mx;
        mx = c[i];
      } else if (cur > f[smx] && c[i] != mx)
        smx = c[i];
      f[c[i]] = max(f[c[i]], cur);
      ans = max(ans, cur);
    }
    cout << ans << '\n';
  }
}
