#include <bits/stdc++.h>
using namespace std;
long long int a[100001], b[100001], c[100001];
struct Node {
  long long int num;
  long long int color;
} max1, max2, t;
int main() {
  long long int i, k, n, q, x, y, num;
  cin >> n >> q;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) cin >> b[i];
  for (i = 1; i <= q; i++) {
    cin >> x >> y;
    for (k = 1; k <= n; k++) c[k] = -1e18;
    max1.num = max2.num = 0;
    max1.color = max2.color = 0;
    for (k = 1; k <= n; k++) {
      num = max(y * a[k], c[b[k]]);
      if (c[b[k]] > -1e18) num = max(num, c[b[k]] + x * a[k]);
      if (max1.color == b[k])
        num = max(num, max2.num + y * a[k]);
      else
        num = max(num, max1.num + y * a[k]);
      c[b[k]] = num;
      if (b[k] == max1.color) {
        if (num > max1.num) max1.num = num;
      } else if (b[k] == max2.color) {
        if (num > max2.num) {
          max2.num = num;
          if (max1.num < max2.num) {
            t = max1;
            max1 = max2;
            max2 = t;
          }
        }
      } else if (num > max1.num) {
        max2 = max1;
        max1.num = num;
        max1.color = b[k];
      } else if (num > max2.num) {
        max2.num = num;
        max2.color = b[k];
      }
    }
    cout << max1.num << endl;
  }
  return 0;
}
