local k = io.read("*n") k = k + 1 local t = {} t[1] = 1 for i = 2, k do t[i] = 0 end local rem = 1 local e = 0 local cnt = 0 while(0.00001 < rem) do cnt = cnt + 1 -- GOAL local tmp = t[k - 1] if(2 < k) then tmp = tmp + t[k - 2] end if(3 < k) then tmp = tmp + t[k - 3] end if(4 < k) then tmp = tmp + t[k - 4] end if(5 < k) then tmp = tmp + t[k - 5] end if(6 < k) then tmp = tmp + t[k - 6] end e = e + cnt * tmp / 6 rem = rem - tmp / 6 -- START local st = t[k - 1] * 5 if(2 < k) then st = st + t[k - 2] * 4 end if(3 < k) then st = st + t[k - 3] * 3 end if(4 < k) then st = st + t[k - 4] * 2 end if(5 < k) then st = st + t[k - 5] end st = st / 6 -- MID for i = k - 1, 2, -1 do t[i] = t[i - 1] if(2 < i) then t[i] = t[i] + t[i - 2] end if(3 < i) then t[i] = t[i] + t[i - 3] end if(4 < i) then t[i] = t[i] + t[i - 4] end if(5 < i) then t[i] = t[i] + t[i - 5] end if(6 < i) then t[i] = t[i] + t[i - 6] end t[i] = t[i] / 6 end t[1] = st end print(string.format("%.8f", e))