#include <bits/stdc++.h>
using namespace std;
int n, q, c[100010], val[100010];
long long a, b, dp[100010], bmax[2];
long long solve(void) {
  for (int(i) = 0; (i) < (int)(n); (i)++) dp[i] = -(1ll << 60);
  for (int(i) = 0; (i) < (int)(2); (i)++) bmax[i] = i;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    dp[c[i]] = max(dp[c[i]], max(dp[c[i]] + val[i] * a, val[i] * b));
    long long omax = -(1ll << 60);
    for (int(j) = 0; (j) < (int)(2); (j)++)
      if (bmax[j] != c[i]) omax = max(omax, dp[bmax[j]]);
    dp[c[i]] = max(dp[c[i]], omax + val[i] * b);
    if (c[i] != bmax[0] && dp[c[i]] > dp[bmax[1]]) bmax[1] = c[i];
    if (dp[bmax[0]] < dp[bmax[1]]) swap(bmax[0], bmax[1]);
  }
  long long ans = 0;
  for (int(i) = 0; (i) < (int)(n); (i)++) ans = max(ans, dp[i]);
  return ans;
}
int main(void) {
  cin >> n >> q;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    cin >> val[i];
  }
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    cin >> c[i];
    c[i]--;
  }
  for (int(i) = 0; (i) < (int)(q); (i)++) {
    cin >> a >> b;
    long long resp = solve();
    cout << resp << endl;
  }
  return 0;
}
