require 'prime' X, A, Y, B = gets.split.map(&:to_i) x_prime = X.prime_division.map { |e, cnt| [e, A * cnt] }.to_h y_prime = Y.prime_division.map { |e, cnt| [e, B * cnt] }.to_h y_prime.each do |e, cnt| if x_prime[e].nil? puts 'No' exit elsif x_prime[e] < cnt puts 'No' exit end end puts 'Yes'