from sys import stdin,setrecursionlimit#,set_int_max_str_digits #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') # setrecursionlimit(2000000) # これこどふぉだと無理 # set_int_max_str_digits(200010) mod = 998244353 ii = lambda :int(stdin.readline()) mi = lambda :map(int,stdin.readline().split()) li = lambda :list(mi()) gmi = lambda :map(lambda x: int(x) - 1, stdin.readline().split()) gi = lambda :list(map(lambda x: 0 if x == "." else 1,input())) # グリッド入力受け取り py = lambda :print("Yes") pn = lambda :print("No") pf = lambda :print("First") ps = lambda :print("Second") pyn = lambda x: print("Yes") if x else print("No") vec = [(1,0),(-1,0),(0,-1),(0,1)] vec1 = [(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1),(1,-1)] #8方向 vec2 = [(1,1),(1,0),(0,-1),(-1,-1),(-1,0),(0,1)] # 六角形グリッド inf = 10**18 from collections import defaultdict,deque from heapq import heappop,heappush #from random import randint def f(n): ret = [] for i in range(1,int(n**0.5)+1): if n % i == 0: ret.append(i) if i*i != n: ret.append(n//i) return sorted(ret) n = ii() a = f(n) dp = defaultdict(float) dp[1] = 0.0 for x in a[1:]: tmp = f(x)[::-1] m = len(tmp) cnt = [0]*m for i in range(m): c = n//tmp[i] cnt[i] += c for j in range(i): if tmp[j] % tmp[i] == 0: cnt[i] -= cnt[j] if tmp[i] != x: dp[x] += dp[tmp[i]]*cnt[i]/(n-cnt[0]) else: dp[x] += n/(n-cnt[i]) print(dp[n])