#include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,h,x; cin>>n>>h>>x; vector d; d.push_back(0); int g; cin>>g; vector gs(g); for(int i = 0;i>gs[i]; for(int j = -x;j<=x;j++){ int ni = gs[i] + j; if(ni<0) continue; if(ni>=n) continue; d.push_back(ni); } } int b; cin>>b; vectorbs(b); for(int i = 0;i>bs[i]; for(int j = -x;j<=x;j++){ int ni = bs[i] + j; if(ni<0) continue; if(ni>=n) continue; d.push_back(ni); } } set gg,bb; for(int i = 0;i> dp(m+1,vector(2010,1e18)); if(gg.count(0)==1) dp[0][mask+1] = 0; else if(bb.count(0)==1) dp[0][mask-1] = 0; else dp[0][mask] = 0; for(int i = 0;i+1d[i]+1){ int nj = d[i+1]; if(gg.count(nj)==1) dp[i+1][j+1] = min(dp[i][j],dp[i+1][j+1]); else if(bb.count(nj)==1) dp[i+1][j-1] = min(dp[i][j],dp[i+1][j-1]); else dp[i+1][j] = min(dp[i][j],dp[i+1][j]); }else{ int nxt = d[i+1]; if(bb.count(nxt)==1){ dp[i+1][j-1] = min(dp[i][j],dp[i+1][j-1]); }else if(gg.count(nxt)==1){ dp[i+1][j+1] = min(dp[i][j],dp[i+1][j+1]); }else{ dp[i+1][j] = min(dp[i][j],dp[i+1][j]); } } int ni = lower_bound(d.begin(),d.end(),d[i]+x) - d.begin(); if(ni==m) continue; if(d[ni]!=d[i]+x) continue; int nj = d[ni]; if(bb.count(nj)==1){ dp[ni][j-1] = min(dp[i][j]+1,dp[ni][j-1]); } else if(gg.count(nj)==1){ dp[ni][j+1] = min(dp[i][j]+1,dp[ni][j+1]); }else{ dp[ni][j] = min(dp[i][j]+1,dp[ni][j]); } } } for(int i = 2010;i--;){ if(dp[m-1][i]<=h){ cout<