n, h, x = map(int,input().split()) G = int(input()) g = list(map(int,input().split())) B = int(input()) b = list(map(int,input().split())) score = [0] * n for i in range(G): score[g[i]-1] = 1 for i in range(B): score[b[i]-1] = -1 dp = [[] for j in range(n+1)] dp[0] = [10 ** 9] * 201 dp[0][100] = 0 for i in range(n): dp[i+1] = [10 ** 9] * 201 for j in range(201): if not (0 <= j+score[i] <= 200): continue if i+1-x < 0: dp[i+1][j+score[i]] = dp[i][j] else: dp[i+1][j+score[i]] = min(dp[i+1-x][j]+1, dp[i][j]) if i+1-x >= 0: dp[i+1-x] = [] ans = -200 for i in range(201): if dp[n][i] <= h: ans = max(ans, i - 100) print(ans)