#include <bits/stdc++.h>
using namespace std;
const int MAX = 100001;
long long v[MAX], c[MAX], dp[MAX];
int main() {
  int n, m, a, b;
  while (cin >> n >> m) {
    for (int i = 0; i < n; ++i) scanf("%I64d", &v[i]);
    for (int i = 0; i < n; ++i) scanf("%I64d", &c[i]);
    for (int k = 0; k < m; ++k) {
      for (int i = 1; i <= n; ++i) dp[i] = -1000000000000006ll;
      cin >> a >> b;
      int fd = 0, sd = 0;
      long long temp;
      for (int i = 0; i < n; ++i) {
        temp = max(dp[c[i]], v[i] * b);
        if (dp[c[i]] != 1000000000000006ll)
          temp = max(temp, dp[c[i]] + v[i] * a);
        if (fd != c[i])
          temp = max(temp, dp[fd] + v[i] * b);
        else
          temp = max(temp, dp[sd] + v[i] * b);
        if (temp >= dp[fd] && c[i] != fd) {
          sd = fd;
          fd = c[i];
        } else if (temp >= dp[sd] && c[i] != sd && c[i] != fd)
          sd = c[i];
        dp[c[i]] = temp;
      }
      printf("%I64d\n", dp[fd]);
    }
  }
  return 0;
}
