#include <bits/stdc++.h>
using namespace std;
long long n, q;
pair<long long, long long> arr[100003];
long long dp[100003];
long long max1, max2;
long long idx1, idx2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> arr[i].second;
  for (int i = 1; i <= n; i++) cin >> arr[i].first;
  for (int i = 1; i <= q; i++) {
    long long a, b;
    cin >> a >> b;
    for (int j = 1; j <= n; j++) dp[j] = -1000000000000000000;
    max1 = -1000000000000000000;
    max2 = -1000000000000000000;
    idx1 = idx2 = 0;
    for (int j = 1; j <= n; j++) {
      long long curr_dp = b * arr[j].second;
      if (dp[arr[j].first] != -1000000000000000000)
        curr_dp = max(curr_dp, dp[arr[j].first] + a * arr[j].second);
      if (idx1 == arr[j].first)
        curr_dp = max(curr_dp, max2 + b * arr[j].second);
      else
        curr_dp = max(curr_dp, max1 + b * arr[j].second);
      if (curr_dp > dp[arr[j].first]) {
        dp[arr[j].first] = curr_dp;
        if (curr_dp >= max1) {
          if (idx1 == arr[j].first)
            max1 = curr_dp;
          else {
            max2 = max1;
            idx2 = idx1;
            max1 = curr_dp;
            idx1 = arr[j].first;
          }
        } else if (curr_dp > max2) {
          idx2 = arr[j].first;
          max2 = curr_dp;
        }
      }
    }
    long long ans = 0;
    for (int j = 1; j <= n; j++) ans = max(ans, dp[j]);
    cout << ans << '\n';
  }
}
