# C import math # import scipy.misc as scm def nCr(n, r): """ Calculate the number of combination (nCr = nPr/r!). The parameters need to meet the condition of n >= r >= 0. It returns 1 if r == 0, which means there is one pattern to choice 0 items out of the number of n. """ # 10C7 = 10C3 r = min(r, n-r) # Calculate the numerator. numerator = 1 for i in range(n, n-r, -1): numerator *= i # Calculate the denominator. Should use math.factorial? denominator = 1 for i in range(r, 1, -1): denominator *= i return numerator // denominator N = int(input()) if N == 0: print(1) quit() if N == 1 or N == 2: print(2) quit() arr = [[0 for j in range(int(math.log(N, 5))+1)] for i in range(int(math.log(N, 3))+1)] # 1 indexed ans = 2 + int(math.log(N, 5)) + int(math.log(N, 3)) for i in range(1, int(math.log(N, 3))+1): for j in range(1, int(math.log(N, 5))+1): if 3**i * 5**j <= N: # ans += scm.comb(i+j, i, 1) ans = nCr(i+j, i) print(ans)