#include int func(int m,int n,int p,int q,int now) { //printf("%d %d %d %d %d\n",m,n,p,q,now); if (m <= 0) return 0; else if ((now>=p)&&(now<=p+q-1)) return func(m-2*n,n,p,q,now%12+1)+1; else return func(m-n,n,p,q,now%12+1)+1; } int main(){ int m,n,p,q; scanf("%d %d %d %d",&m,&n,&p,&q); printf("%d\n", func(m,n,p,q,1)); return 0; }