# Functions def partition(n): if n == 1: return [[1]] sets = partition(n-1) results = [] for set in sets: s = len(set) if 1 < s and set[s-1] < set[s-2]: copy = list(set) copy[s-1] += 1 results.append(copy) set.append(1) results.append(set) results.append([n]) return results def factorial(n): result = 1 for i in range(1,n+1): result *= i return result # Main N = int(input()) sets = partition(N*6) results = [] for set in sets: if set[0] <= N and len(set) <= 8: while len(set) < 8: set.append(0) results.append(set) combs = [] for result in results: comb = {} for number in result: if number in comb: comb[number] += 1 else: comb[number] = 1 combs.append(comb) numerator = factorial(8) result = 0 for comb in combs: denominator = 1 for c in comb.keys(): denominator *= factorial(comb[c]) result += numerator//denominator print(result)