a, b, c, d = gets.chomp.split.map{|e| e.to_i} cnt = 0 loop do c -= a d -= b if c < 0 || d < 0 break end cnt += 1 end puts cnt