sosuu = [2,3,5,7,11,13] gousei = [4,6,8,9,10,12] P,C = gets.split.map(&:to_i) pattern = 6 ** (P + C) p sosuu.repeated_permutation(P).map(&:to_a).product(gousei.repeated_permutation(C).map(&:to_a)).map(&:flatten).map{|a|a.inject(&:*)}.inject(&:+) * 1.0 / pattern