A, B, C, D = map(int, input().split()) ans = 0 for i in range(10000): if A * i <= C and B * i <= D: ans = i print(ans)