import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] n = int(input()) @functools.lru_cache(maxsize=100000000) def calc(x): if x == 1: return 0 res = 0 div = make_divisors(x) c = collections.defaultdict(int) for i in reversed(div): if i == x: c[x] = 1 continue ans = x//i for j in div: if j % i == 0: ans -= c[j] c[i] = ans res += ans * calc(i) res /= x res += 1 return res / (1 - 1/x) print(calc(n))