#include <bits/stdc++.h>
using namespace std;
const int maxN = 100005;
const long long inf = 1LL << 61;
int n, m, c[maxN], v[maxN];
int bo[maxN];
long long f[maxN], w;
long long ans;
void init() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", v + i);
  for (int i = 1; i <= n; ++i) scanf("%d", c + i);
}
void make(long long a, long long b) {
  ++w;
  long long vm, cm, vm2, cm2, g;
  cm = 0;
  cm2 = 0;
  vm = -inf;
  vm2 = -inf;
  ans = 0;
  for (int i = 1; i <= n; ++i) {
    g = v[i] * b;
    if (bo[c[i]] == w) {
      g = ((g) > (f[c[i]] + v[i] * a) ? (g) : (f[c[i]] + v[i] * a));
    }
    if (cm) {
      if (cm != c[i]) {
        g = ((g) > (vm + v[i] * b) ? (g) : (vm + v[i] * b));
      } else if (cm2) {
        g = ((g) > (vm2 + v[i] * b) ? (g) : (vm2 + v[i] * b));
      }
    }
    ans = ((ans) > (g) ? (ans) : (g));
    if (g >= vm) {
      if (cm == c[i]) {
        vm = g;
      } else {
        cm2 = cm;
        vm2 = vm;
        vm = g;
        cm = c[i];
      }
    } else {
      if (g > vm2 && c[i] != cm) {
        cm2 = c[i];
        vm2 = g;
      }
    }
    if (bo[c[i]] != w) {
      bo[c[i]] = w;
      f[c[i]] = g;
    } else {
      f[c[i]] = ((f[c[i]]) > (g) ? (f[c[i]]) : (g));
    }
  }
}
void work() {
  int a, b;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &a, &b);
    make(a, b);
    printf("%I64d\n", ans);
  }
}
int main() {
  init();
  work();
  return 0;
}
