#include <bits/stdc++.h>
using namespace std;
void USACO(string s) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const long long MAXN = 100010;
long long n, q;
long long v[MAXN], c[MAXN];
void init() {
  cin >> n >> q;
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> c[i];
  }
}
void solve() {
  init();
  while (q--) {
    long long mx[n + 1];
    mx[0] = 0;
    for (int i = 1; i <= n; i++) {
      mx[i] = -1e15;
    }
    long long r = 0, s = 0;
    long long a, b;
    cin >> a >> b;
    for (long long i = 0; i < n; i++) {
      long long value = max((a * v[i]) + mx[c[i]], mx[s] + (b * v[i]));
      if (c[i] != r) value = max(value, mx[r] + (b * v[i]));
      if (c[i] != r) {
        if (value > mx[r]) {
          s = r;
          r = c[i];
        } else if (value > mx[s]) {
          s = c[i];
        }
      }
      mx[c[i]] = max(mx[c[i]], value);
    }
    cout << mx[r] << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
