#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> u, v;
int d[100020];
int c[100020];
int n, q;
long long f[100020], a, b;
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", d + i);
  for (int i = 1; i <= n; i++) scanf("%d", c + i);
  for (int i = 0; i < q; i++) {
    cin >> a >> b;
    memset(f, 0xc0, sizeof f);
    u = pair<int, int>(0, 0);
    v = pair<int, int>(-0x3f3f3f3f3f3f3f3fLL, 0);
    for (int i = 1; i <= n; i++) {
      long long w = -0x3f3f3f3f3f3f3f3fLL;
      if (c[i] != u.second)
        w = max(w, u.first + b * d[i]);
      else
        w = max(w, v.first + b * d[i]);
      w = max(w, f[c[i]] + a * d[i]);
      f[c[i]] = max(f[c[i]], w);
      if (w > v.first) {
        if (w > u.first) {
          if (c[i] != u.second) v = u;
          u = pair<long long, long long>(w, c[i]);
        } else if (c[i] != u.second) {
          v = pair<long long, long long>(w, c[i]);
        }
      }
    }
    cout << u.first << endl;
  }
  return 0;
}
