N,M,P,Q = map(int,input().split()) ans = 0 P -= 1 while N > 0: if P <= (ans % 12) < P+Q: N -= 2*M else: N -= M ans += 1 print(ans)