a,b,c,d = gets.split.map(&:to_i) idealMax = d / c realMax = b / c puts [a, realMax, idealMax].min