#include <bits/stdc++.h>
using namespace std;
const int Max = 100100;
const long long inf = 1e19;
int ball_c[Max];
long long ball_v[Max];
long long dp[Max];
int n;
void input() {
  ball_c[0] = 0;
  ball_v[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &ball_v[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ball_c[i]);
  }
}
long long solve(int a, int b) {
  fill(dp, dp + n + 5, -inf);
  dp[0] = 0;
  int m1 = 0, m2 = 0;
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    long long t2;
    long long t1 = -inf;
    if (dp[ball_c[i]] != -inf) t1 = dp[ball_c[i]] + a * ball_v[i];
    if (m1 != ball_c[i]) {
      t2 = dp[m1] + b * ball_v[i];
    } else {
      t2 = dp[m2] + b * ball_v[i];
    }
    dp[ball_c[i]] = max(t1, dp[ball_c[i]]);
    dp[ball_c[i]] = max(t2, dp[ball_c[i]]);
    if (m1 == ball_c[i] || m2 == ball_c[i]) {
      if (dp[m1] < dp[m2]) swap(m1, m2);
    } else {
      if (dp[m1] < dp[ball_c[i]]) {
        m2 = m1;
        m1 = ball_c[i];
      } else if (dp[m2] < dp[ball_c[i]]) {
        m2 = ball_c[i];
      }
    }
    res = max(dp[ball_c[i]], res);
  }
  return res;
}
int main() {
  int m, a, b;
  cin >> n >> m;
  input();
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    cout << solve(a, b) << endl;
  }
  return 0;
}
