def lscan; gets.split.map(&:to_i); end a,b,c,d = lscan a*c == b a.downto(0) do |y| next unless y*c <= b p y exit end