#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e17, N = 1e5 + 10;
long long int n, q, a, b, c[N], v[N], dp[N], mx[N], mx1, mx2, ans;
int i;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (i = 0; i < n; i++) cin >> v[i];
  for (i = 0; i < n; i++) {
    cin >> c[i];
    c[i]--;
  }
  while (q--) {
    cin >> a >> b;
    for (i = 0; i < n; i++) {
      dp[i] = v[i] * b;
      mx[i] = -inf;
    }
    ans = 0;
    mx2 = -1;
    mx1 = 0;
    for (i = 0; i < n; i++) {
      if (i) {
        if (c[mx1] == c[i])
          dp[i] = max(dp[i], dp[mx1] + v[i] * a);
        else
          dp[i] = max(dp[i], dp[mx1] + v[i] * b);
      }
      if (mx2 != -1) {
        if (c[mx2] == c[i])
          dp[i] = max(dp[i], dp[mx2] + v[i] * a);
        else
          dp[i] = max(dp[i], dp[mx2] + v[i] * b);
      }
      dp[i] = max(dp[i], mx[c[i]] + v[i] * a);
      mx[c[i]] = max(mx[c[i]], dp[i]);
      if (dp[i] > dp[mx1]) {
        if (c[i] == c[mx1])
          mx1 = i;
        else {
          mx2 = mx1;
          mx1 = i;
        }
      } else if (c[mx1] != c[i] and (mx2 == -1 or dp[i] > dp[mx2]))
        mx2 = i;
      ans = max(ans, dp[i]);
    }
    cout << ans << '\n';
  }
}
