a,b,c,d=map(int,input().split()) x = 9999 if a == 0 else c // a y = 9999 if b == 0 else d // b print(min(x,y))