require 'prime' p, c = gets.split.map(&:to_i) prime = Prime.each(13).to_a composite = Array(2..13) - prime sum = 0.0 prime.repeated_permutation(p).each do |x| composite.repeated_permutation(c).each do |y| sum += x.inject(1, :*) * y.inject(1, :*) end end puts sum / 6**(p + c)