



"""simple docstring"""





from __future__ import annotations
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			int    ):


						'''simple docstring'''






						if b == 0:
												return (1, 0)
						((snake_case_)			,		(snake_case_))   : Union[str, Any]						=			extended_euclid(__UpperCamelCase					, a % b    )
						snake_case_   : Optional[int]						=			a // b
						return (y, x - k * y)
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			int					, __UpperCamelCase      :			int					, __UpperCamelCase      :			int    ):


						'''simple docstring'''






						((snake_case_)			,		(snake_case_))   : List[str]						=			extended_euclid(__UpperCamelCase					, __UpperCamelCase    )
						snake_case_   : Union[str, Any]						=			na * na
						snake_case_   : Union[str, Any]						=			ra * x * na + ra * y * na
						return (n % m + m) % m
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			int    ):


						'''simple docstring'''






						((snake_case_)			,		(snake_case_))   : List[str]						=			extended_euclid(__UpperCamelCase					, __UpperCamelCase    )
						if b < 0:
												snake_case_   : Dict						=			(b % n + n) % n
						return b
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			int					, __UpperCamelCase      :			int					, __UpperCamelCase      :			int    ):


						'''simple docstring'''






						snake_case_			,		snake_case_   : Optional[int]						=			invert_modulo(__UpperCamelCase					, __UpperCamelCase    ), invert_modulo(__UpperCamelCase					, __UpperCamelCase    )
						snake_case_   : Union[str, Any]						=			na * na
						snake_case_   : Any						=			ra * x * na + ra * y * na
						return (n % m + m) % m


if __name__ == "__main__":
					from doctest import testmod

					testmod(name='''chinese_remainder_theorem''', verbose=True)
					testmod(name='''chinese_remainder_theorem2''', verbose=True)
					testmod(name='''invert_modulo''', verbose=True)
					testmod(name='''extended_euclid''', verbose=True)






"""simple docstring"""





def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			int    ):


						'''simple docstring'''






						snake_case_   : Any						=			1  # To kept the Calculated Value
						# Since C(n, k) = C(n, n-k)
						if k > (n - k):
												snake_case_   : Optional[int]						=			n - k
						# Calculate C(n,k)
						for i in range(__UpperCamelCase    ):
												result *= n - i
												result //= i + 1
						return result
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						return binomial_coefficient(2 * node_count					, __UpperCamelCase    ) // (node_count + 1)
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						if n < 0:
												raise ValueError("""factorial() not defined for negative values"""    )
						snake_case_   : Optional[int]						=			1
						for i in range(1					, n + 1    ):
												result *= i
						return result
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						return catalan_number(__UpperCamelCase    ) * factorial(__UpperCamelCase    )


if __name__ == "__main__":
					__lowerCAmelCase       :					Optional[Any]      					=					int(input('''Enter the number of nodes: ''').strip() or 0)
					if node_count <= 0:
										raise ValueError('''We need some nodes to work with.''')
					print(
					    F'''Given {node_count} nodes, there are {binary_tree_count(node_count)} '''
					    F'''binary trees and {catalan_number(node_count)} binary search trees.'''
					)

