#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 100;
const int ub = 1e6;
const long long INF = 1e18;
long long powmod(long long x, long long y) {
  long long t;
  for (t = 1; y; y >>= 1, x = x * x % mod)
    if (y & 1) t = t * x % mod;
  return t;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int n, m, c[maxn], v[maxn], id1, id2;
long long dp[maxn], ans, max1, max2;
long long solve(int x) {
  if (id1 == -1) return -INF;
  if (x == id1) {
    if (id2 != -1)
      return max2;
    else
      return -INF;
  } else {
    return max1;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int(i) = (1); (i) < (n + 1); (i)++) scanf("%d", &v[i]);
  for (int(i) = (1); (i) < (n + 1); (i)++) scanf("%d", &c[i]);
  for (int(i) = (0); (i) < (m); (i)++) {
    int a, b;
    scanf("%d%d", &a, &b);
    for (int(j) = (1); (j) < (n + 1); (j)++) dp[j] = -INF;
    ans = -INF, max1 = -INF, max2 = -INF;
    id1 = -1, id2 = -1;
    for (int(j) = (1); (j) < (n + 1); (j)++) {
      long long val =
          max(dp[c[j]] + 1LL * a * v[j], 1LL * b * v[j] + solve(c[j]));
      val = max(val, 1LL * b * v[j]);
      dp[c[j]] = max(dp[c[j]], val);
      ans = max(ans, dp[c[j]]);
      if (val >= max1) {
        if (id1 == c[j])
          max1 = val;
        else {
          max2 = max1, id2 = id1;
          max1 = val, id1 = c[j];
        }
      } else if (val > max2) {
        if (id1 != c[j]) max2 = val, id2 = c[j];
      }
    }
    printf("%lld\n", max(0LL, ans));
  }
  return 0;
}
