str = gets.split q = str[0].to_i c = str[1].to_i ps = [2, 3, 5, 7, 11, 13] cs = [4, 6, 8, 9, 10, 12] pps = Hash.new(0) ccs = Hash.new(0) qc = ps.length ** q cc = cs.length ** c if qc > 1 qc.times do |i| bin = i.to_s(6) w = 1 q.times do |j| if j < bin.length w *= ps[bin[j].to_i] else w *= ps[0] end end pps[w] += 1 end else pps[1] = 1 end if cc > 1 cc.times do |i| bin = i.to_s(6) w = 1 c.times do |j| if j < bin.length w *= cs[bin[j].to_i] else w *= cs[0] end end ccs[w] += 1 end else ccs[1] = 1 end m = Hash.new(0) pps.each do |k1, v1| ccs.each do |k2, v2| m[k1 * k2] += v1 * v2; end end sum = 0 m.each do |k, v| sum += k * v end puts sum.to_f / (qc * cc)