#include <bits/stdc++.h>
using namespace std;
int N, Q;
long long c[100001];
long long v[100001];
long long a, b;
long long bestEndingIn[100001];
void build() {
  bestEndingIn[0] = 0;
  for (int i = 1; i <= N; i++) bestEndingIn[i] = -20000000000000;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> Q;
  for (int i = 1; i <= N; i++) cin >> v[i];
  for (int i = 1; i <= N; i++) cin >> c[i];
  while (Q--) {
    cin >> a >> b;
    build();
    long long maximum = 0;
    long long maxColor = 0;
    long long secondMaximum = 0;
    long long secondColor = 0;
    for (int i = 1; i <= N; i++) {
      long long maxWithMyColor = bestEndingIn[c[i]];
      long long maxWithoutMyColor = maxColor == c[i] ? secondMaximum : maximum;
      long long bestUsingVI =
          max(maxWithMyColor + a * v[i], maxWithoutMyColor + b * v[i]);
      bestEndingIn[c[i]] = max(bestEndingIn[c[i]], bestUsingVI);
      if (bestUsingVI > maximum) {
        if (maxColor == c[i])
          maximum = bestUsingVI;
        else {
          secondColor = maxColor;
          secondMaximum = maximum;
          maximum = bestUsingVI;
          maxColor = c[i];
        }
      } else if (bestUsingVI > secondMaximum) {
        if (maxColor == c[i])
          continue;
        else {
          secondMaximum = bestUsingVI;
          secondColor = c[i];
        }
      }
    }
    cout << maximum << '\n';
  }
  cout << flush;
  return 0;
}
