#include <bits/stdc++.h>
using namespace std;
int n, p, m, a[2][1001 + 51], c[1001 + 51];
int Solve() {
  int ans = INT_MIN;
  vector<vector<vector<vector<int> > > > dp(n + m + 1);
  for (int i = 0; i <= n + m; i++) {
    dp[i].resize(p + 1);
    for (int j = 0; j <= p; j++) {
      dp[i][j].resize(m + 1);
      for (int k = 0; k <= m; k++) {
        dp[i][j][k].resize(2);
        if (j == 0 && k != 0)
          for (int x = 0; x < 2; x++) dp[i][j][k][x] = INT_MIN;
      }
    }
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j < p; j++)
      for (int k = 0; k <= m; k++)
        for (int x = 0; x < 2; x++) {
          if (k == 0)
            for (int y = 0; y < 2; y++) {
              if (i > 0)
                dp[i][j][k][x] = max(dp[i][j][k][x], dp[i - 1][j][k][y]);
              if (j > 0)
                dp[i][j][k][x] = max(dp[i][j][k][x], dp[i][j - 1][k][y]);
            }
          for (int is = i + k, ix = is, i_max = i + m; ix <= i_max; ix++)
            dp[ix][j + 1][i_max - ix][1 - x] = max(
                dp[ix][j + 1][i_max - ix][1 - x],
                dp[i][j][k][x] + c[is] - c[i] + a[1 - x][ix] - a[1 - x][is]);
          for (int is = i + k, ix = is, i_max = i + m; ix <= i_max; ix++)
            dp[ix][j + 1][i_max - ix][x] =
                max(dp[ix][j + 1][i_max - ix][x],
                    dp[i][j][k][x] + a[x][ix] - a[x][is]);
        }
  for (int i = 0; i <= n + m; i++)
    for (int j = 0; j <= p; j++)
      for (int k = 0; k <= m; k++)
        for (int x = 0; x < 2; x++) ans = max(ans, dp[i][j][k][x]);
  return ans;
}
int main() {
  int r, s, ans;
  cin >> n >> p >> m;
  cin >> r;
  while (r--) {
    int i;
    cin >> i;
    a[0][i] = 1;
  }
  cin >> s;
  while (s--) {
    int i;
    cin >> i;
    a[1][i] = 1;
  }
  for (int i = 1; i <= n + m; i++) {
    c[i] = (a[0][i] | a[1][i]);
    a[0][i] += a[0][i - 1];
    a[1][i] += a[1][i - 1];
    c[i] += c[i - 1];
  }
  if (2 * ((n + m - 1) / m) <= p)
    ans = c[n];
  else
    ans = Solve();
  cout << ans << '\n';
  return 0;
}
