import sys def main(): N, M, P, Q = map(int, input().split()) n = N m = 1 for i in range(1, sys.maxsize): if P <= m < P + Q: n -= M n -= M m += 1 if m > 12: m = 1 if n <= 0: print(i) break main()