#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 90000000000000000;
inline bool checkBit(long long n, int i) { return n & (1LL << i); }
inline long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long modMul(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long modAdd(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long modSub(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
const int MX = 101000;
long long dp[MX], v[MX];
int c[MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = 0; i < n; ++i) cin >> c[i];
  while (q--) {
    int a, b;
    cin >> a >> b;
    for (int i = 0; i <= n; ++i) dp[i] = -infLL;
    int best = 0, sbest = 0;
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
      int focus;
      if (best == c[i])
        focus = sbest;
      else
        focus = best;
      long long temp = b * v[i];
      temp = max(temp, dp[c[i]] + a * v[i]);
      temp = max(temp, dp[focus] + b * v[i]);
      dp[c[i]] = max(dp[c[i]], temp);
      ;
      ans = max(dp[c[i]], ans);
      if (c[i] == best) continue;
      if (dp[c[i]] > dp[best])
        sbest = best, best = c[i];
      else if (dp[c[i]] > dp[sbest])
        sbest = c[i];
    }
    cout << ans << '\n';
  }
  return 0;
}
