#include <bits/stdc++.h>
using namespace std;
int Color[100005], Val[100005], Last[100005];
long long Best[100005], BestColor[100005];
int n, i, q;
int a, b;
pair<long long, long long> max1, max2;
struct edge {
  int a, b, c;
};
long long maxim(long long a, long long b) {
  if (a > b) return a;
  return b;
}
int main() {
  cin >> n >> q;
  for (i = 1; i <= n; ++i) {
    cin >> Val[i];
  }
  Color[0] = -1;
  for (i = 1; i <= n; ++i) {
    cin >> Color[i];
  }
  for (i = 1; i <= n; ++i) {
    if (Best[Color[i]]) {
      Last[i] = 1;
    }
    Best[Color[i]] = 1;
  }
  for (; q; --q) {
    cin >> a >> b;
    max1.first = max2.first = 0;
    max1.second = max2.second = -1;
    for (i = 1; i <= n; ++i)
      Best[i] = BestColor[i] = -1LL * LONG_MAX * LONG_MAX;
    for (i = 1; i <= n; ++i) {
      long long act, other;
      other = 1LL * b * Val[i];
      if (max1.second == Color[i]) {
        other = 1LL * other + 1LL * max2.first;
      } else {
        other = 1LL * other + 1LL * max1.first;
      }
      if (other < 1LL * a * Val[i] + 1LL * BestColor[Color[i]])
        other = 1LL * a * Val[i] + 1LL * BestColor[Color[i]];
      Best[i] = other;
      if (BestColor[Color[i]] < other) {
        BestColor[Color[i]] = other;
      }
      if (Best[i] >= max1.first) {
        if (Color[i] == max1.second) {
          max1.first = Best[i];
        } else {
          max2 = max1;
          max1.first = Best[i];
          max1.second = Color[i];
        }
      } else {
        if (Best[i] >= max2.first) {
          if (Color[i] == max1.second)
            ;
          else {
            max2.first = Best[i];
            max2.second = Color[i];
          }
        }
      }
    }
    cout << max1.first << "\n";
  }
  return 0;
}
