#include int func(int m,int n,int p,int q,int now) { if (m < 0) return 1; else if (m == 0) return 0; else if ((now>=p)&&(now<=p+q)) 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; }