Q = 1000_000
N, K = 2.times.map{gets.to_i}
R = Array.new(1 << 20){|i| (i % 6) + 1 }.shuffle
T = Array.new(1 << 20){|i| (i % 3) + 4 }.shuffle

(1 ... R.size).each{|i| R[i] += R[i - 1]; T[i] += T[i - 1] }

ans = Q.times.count do
  j = rand(1000_000).then{|j| R[j + N] - R[j] }
  t = rand(1000_000).then{|j| T[j + K] - T[j] + R[j + N - K] - R[j] }
  t > j
end
puts ans.to_f / Q