K = gets.to_i def f(k) if k >= K 0.0 else 1 + ((1..6).map {|i| f(k + i)}.inject(:+) / 6) end end ans = f(0) puts ans