A,B,C,D=map(int,input().split()) print(min(C//A,D//B))