N, M, P, Q= map(int,input().split()) while True: for i in range(1,13): if P <= i <= (P+Q-1): N -= M*2 else: N -= M if N <= 0: print(i) exit()