N, M, P, Q = map(int, input().split()) v = 12 * M + Q * M ans = N // v * 12 N %= v P -= 1 L = [M] * 12 for i in range(P, P + Q): L[i] += M for i in range(12): N -= L[i] ans += 1 if N <= 0: break print(ans)