A, B, C, D = map(int, input().split()) ca = A cb = B ans = 0 for i in range(100): if (ans + 1) + (ans + 1) * C <= D and ca > 0 and cb > 0: ca -= 1 cb -= C ans += 1 else: break print(ans)