def main(): import sys input = sys.stdin.read from scipy.linalg import solve K = int(input().strip()) # 期待値の方程式を構築 A = [[0] * K for _ in range(K)] B = [0] * K for i in range(K): A[i][i] = 1 for j in range(1, 7): if i + j < K: A[i][i + j] -= 1 / 6 else: B[i] += 1 / 6 # 連立方程式を解く E = solve(A, B) # 結果を出力 print(f"{E[0]:.10f}") if __name__ == "__main__": main()