MOD = 10 ** 9 + 7 INF = 10 ** 10 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) def main(): n,m,p,q = map(int,input().split()) q += p - 1 cnt = 0 while n > 0: for i in range(1,13): cnt += 1 if p <= i <= q: n -= 2*m else: n -= m if n <= 0: break print(cnt) if __name__ == '__main__': main()