#yuki740 n,m,p,q=map(int,raw_input().split()) a=[] for i in xrange(p): a.append(m) for i in xrange(p,p+q): a.append(m*2) for i in xrange(p+q,12): a.append(m) x=0 while n>0: n-=a[x%12] x+=1 print x