
from __future__ import annotations

from collections import namedtuple
from dataclasses import dataclass


@dataclass
class 				lowercase					:
		__lowercase       :       List[Any]	     =				42
		__lowercase       :       Any	     =				None
		__lowercase       :       Union[str, Any]	     =				None






_UpperCAmelCase					: Dict      =       namedtuple("CoinsDistribResult", "moves excess")


def       A       (					lowercase )   ->  int:
		'''simple docstring'''

		if root is None:
				return 0

		# Validation
		def count_nodes(lowercase ) -> int:
				if node is None:
						return 0

				return count_nodes(node.left ) + count_nodes(node.right ) + 1

		def count_coins(lowercase ) -> int:
				if node is None:
						return 0

				return count_coins(node.left ) + count_coins(node.right ) + node.data

		if count_nodes(__a ) != count_coins(__a ):
				raise ValueError('The nodes number should be same as the number of coins' )

		# Main calculation
		def get_distrib(lowercase ) -> CoinsDistribResult:

				if node is None:
						return CoinsDistribResult(0    ,       1 )

				UpperCamelCase		=     get_distrib(node.left )
				UpperCamelCase		=     get_distrib(node.right )

				UpperCamelCase		=     1 - left_distrib_excess
				UpperCamelCase		=     1 - right_distrib_excess

				UpperCamelCase		=     (
				    left_distrib_moves
				    + right_distrib_moves
				    + abs(__a )
				    + abs(__a )
				)
				UpperCamelCase		=     node.data - coins_to_left - coins_to_right

				return CoinsDistribResult(__a    ,       __a )

		return get_distrib(__a )[0]


if __name__ == "__main__":
					import doctest

					doctest.testmod()








"""simple docstring"""






from math import factorial



def 					_A			(__a = 20							) ->       int:
    """simple docstring"""






    SCREAMING_SNAKE_CASE_      :  Dict    						=		2 * n  # middle entry of odd rows starting at row 3 is the solution for n = 1,
    # 2, 3,...
    SCREAMING_SNAKE_CASE_      :  List[str]    						=		n // 2

    return int(factorial(__a							) / (factorial(__a							) * factorial(n - k							))							)


if __name__ == "__main__":
  import sys

  if len(sys.argv) == 1:
    print(solution(20))
  else:
    try:
      UpperCAmelCase_   : List[str]   			= int(sys.argv[1])
      print(solution(n))
    except ValueError:
      print("""Invalid entry - please enter a number.""")


