K = gets.to_i N = 100000 total_count = 0 N.times{ count = 0 loop { sum = 0 while sum < K sum += rand(1..6) count += 1 end break if sum == K } total_count += count } p total_count.fdiv N