import numpy as np def pow_matrix_mod(x, n): if not n: return np.eye(len(x), dtype=float) if n % 2 == 0: return pow_matrix_mod(x @ x, n // 2) else: return x @ pow_matrix_mod(x @ x, (n - 1) // 2) N = int(input()) dp = np.zeros(7, dtype=float) dp[0] = 1.0 A = [[0] * 7 for _ in range(7)] for i in range(6): A[i][i + 1] = (6 - i) / 6 A[i + 1][i + 1] = (i + 1) / 6 A = np.array(A) res = dp @ pow_matrix_mod(A, N) print(res[6])