#include using namespace std; using ll = long long; #define chmax(a,b) a = max(a,b) pair calc(int a,int b){ return make_pair(min(a,b),max(a,b)); } int main(){ int n,k,x,y; cin>>n>>k>>x>>y; vector a(n); for(int i = 0;i>a[i]; vector b(n+2); x %= k; y %= k; b[0] = x % k; b[1] = y % k; for(int i = 0;i> tmp(n+2,vector(k+1,-1e9)); tmp[0][y] = 0; tmp[1][x] = 0; vector cnt(n+2,0); for(int i = 0;i=0){ int can = max(tmp[j][need]+1,cnt[j]); chmax(tmp[i+2][nxt],can); chmax(cnt[i+2],can); chmax(cnt[j],can); chmax(tmp[j][need],tmp[j][need]+1); chmax(tmp[j][now],can); ans = max(ans,can); }else{ int can = cnt[j]; chmax(tmp[i+2][nxt],can); chmax(cnt[i+2],can); chmax(tmp[j][now],can); ans = max(ans,can); } } } cout<