



from __future__ import annotations

from random import random



class 	lowerCamelCase__      :




		'''simple docstring'''



		def __init__(self		,__lowerCamelCase = None			)					->      List[str]:

						"""simple docstring"""






						lowerCAmelCase__					:    List[str]												=					value
						lowerCAmelCase__					:    Any												=					random()
						lowerCAmelCase__					:    Node | None												=					None
						lowerCAmelCase__					:    Node | None												=					None



		def __repr__(self			)					->      str:

						"""simple docstring"""






						from pprint import pformat

						if self.left is None and self.right is None:
										return f"""'{self.value}: {self.prior:.5}'"""
						else:
										return pformat(
										    {f"""{self.value}: {self.prior:.5}""": (self.left, self.right)}		,indent=1			)



		def __str__(self			)					->      str:

						"""simple docstring"""






						lowerCAmelCase__					:    int												=					str(self.value			) + ''' '''
						lowerCAmelCase__					:    Optional[int]												=					str(self.left or ''''''			)
						lowerCAmelCase__					:    Tuple												=					str(self.right or ''''''			)
						return value + left + right






def      lowerCAmelCase__		(   lowerCamelCase_		:		Node | None	,lowerCamelCase_		:		int):





				'''simple docstring'''

				if root is None:  # None tree is split into 2 Nones
								return None, None
				elif root.value is None:
								return None, None
				else:
								if value < root.value:
												lowerCAmelCase__						,		lowerCAmelCase__					:    Optional[Any]												=					split(root.left	,lowerCamelCase_)
												return left, root
								else:
												lowerCAmelCase__						,		lowerCAmelCase__					:    List[Any]												=					split(root.right	,lowerCamelCase_)
												return root, right






def      lowerCAmelCase__		(   lowerCamelCase_		:		Node | None	,lowerCamelCase_		:		Node | None):





				'''simple docstring'''

				if (not left) or (not right):  # If one node is None, return the other
								return left or right
				elif left.prior < right.prior:
								lowerCAmelCase__					:    Union[str, Any]												=					merge(left.right	,lowerCamelCase_)
								return left
				else:
								lowerCAmelCase__					:    Optional[Any]												=					merge(lowerCamelCase_	,right.left)
								return right






def      lowerCAmelCase__		(   lowerCamelCase_		:		Node | None	,lowerCamelCase_		:		int):





				'''simple docstring'''

				lowerCAmelCase__					:    Optional[int]												=					Node(lowerCamelCase_)
				lowerCAmelCase__						,		lowerCAmelCase__					:    Union[str, Any]												=					split(lowerCamelCase_	,lowerCamelCase_)
				return merge(merge(lowerCamelCase_	,lowerCamelCase_)	,lowerCamelCase_)






def      lowerCAmelCase__		(   lowerCamelCase_		:		Node | None	,lowerCamelCase_		:		int):





				'''simple docstring'''

				lowerCAmelCase__						,		lowerCAmelCase__					:    Optional[Any]												=					split(lowerCamelCase_	,value - 1)
				lowerCAmelCase__						,		lowerCAmelCase__					:    str												=					split(lowerCamelCase_	,lowerCamelCase_)
				return merge(lowerCamelCase_	,lowerCamelCase_)






def      lowerCAmelCase__		(   lowerCamelCase_		:		Node | None):





				'''simple docstring'''

				if not root:  # None
								return
				else:
								inorder(root.left)
								print(root.value	,end=''',''')
								inorder(root.right)






def      lowerCAmelCase__		(   lowerCamelCase_		:		Node | None	,lowerCamelCase_		:		str):





				'''simple docstring'''

				for arg in args.split():
								if arg[0] == "+":
												lowerCAmelCase__					:    Tuple												=					insert(lowerCamelCase_	,int(arg[1:]))

								elif arg[0] == "-":
												lowerCAmelCase__					:    Dict												=					erase(lowerCamelCase_	,int(arg[1:]))

								else:
												print('''Unknown command''')

				return root






def      lowerCAmelCase__		(   ):





				'''simple docstring'''

				lowerCAmelCase__					:    Optional[Any]												=					None
				print(
				    '''enter numbers to create a tree, + value to add value into treap, '''
				    '''- value to erase all nodes with value. \'q\' to quit. ''')

				lowerCAmelCase__					:    str												=					input()
				while args != "q":
								lowerCAmelCase__					:    Optional[int]												=					interact_treap(lowerCamelCase_	,lowerCamelCase_)
								print(lowerCamelCase_)
								lowerCAmelCase__					:    Tuple												=					input()

				print('''good by!''')


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							main()






from math import factorial






def      lowerCAmelCase__		(   lowerCamelCase_		:		int = 100):





				'''simple docstring'''

				return sum(map(lowerCamelCase_	,str(factorial(lowerCamelCase_))))


if __name__ == "__main__":
							print(solution(int(input('Enter the Number: ').strip())))

