





'''simple docstring'''







class        __a   :

							def __init__(				self				:  Dict							,  __magic_name__				:  int )       ->							Union[str, Any]:







													"""simple docstring"""
													UpperCAmelCase_      :   List[Any]      =	val
													# Number of nodes in left subtree
													UpperCAmelCase_      :   int      =	0
													UpperCAmelCase_      :   List[Any]      =	None
													UpperCAmelCase_      :   Tuple      =	None
													UpperCAmelCase_      :   Optional[int]      =	None



							def      UpperCAmelCase__						(				self				:  Tuple							,  __magic_name__				:  Tuple )       ->							List[str]:







													"""simple docstring"""
													assert self.left_tree_size == other.left_tree_size, "Unequal Sizes of Blocks"

													if self.val < other.val:
																			UpperCAmelCase_      :   Union[str, Any]      =	self.right
																			UpperCAmelCase_      :   Tuple      =	None
																			if self.right:
																									UpperCAmelCase_      :   List[Any]      =	other
																			UpperCAmelCase_      :   Dict      =	other
																			UpperCAmelCase_      :   List[str]      =	self.left_tree_size * 2 + 1
																			return self
													else:
																			UpperCAmelCase_      :   Tuple      =	other.right
																			UpperCAmelCase_      :   List[Any]      =	None
																			if other.right:
																									UpperCAmelCase_      :   Optional[Any]      =	self
																			UpperCAmelCase_      :   Optional[Any]      =	self
																			UpperCAmelCase_      :   Tuple      =	other.left_tree_size * 2 + 1
																			return other





class        __a   :

							def __init__(				self				:  Tuple							,  __magic_name__				:  Optional[Any]=None							,  __magic_name__				:  Union[str, Any]=None							,  __magic_name__				:  Dict=0 )       ->							Optional[int]:







													"""simple docstring"""
													UpperCAmelCase_      :   Optional[int]      =	heap_size
													UpperCAmelCase_      :   List[Any]      =	bottom_root
													UpperCAmelCase_      :   List[str]      =	min_node

							def      UpperCAmelCase__						(				self				:  Dict							,  __magic_name__				:  Dict )       ->							Optional[Any]:







													"""simple docstring"""

													# Empty heaps corner cases
													if other.size == 0:
																			return None
													if self.size == 0:
																			UpperCAmelCase_      :   Optional[int]      =	other.size
																			UpperCAmelCase_      :   Union[str, Any]      =	other.bottom_root
																			UpperCAmelCase_      :   int      =	other.min_node
																			return None
													# Update size
													UpperCAmelCase_      :   Union[str, Any]      =	self.size + other.size

													# Update min.node
													if self.min_node.val > other.min_node.val:
																			UpperCAmelCase_      :   int      =	other.min_node
													# Merge

													# Order roots by left_subtree_size
													UpperCAmelCase_      :   Tuple      =	[]
													UpperCAmelCase_    ,							UpperCAmelCase_      :   int      =	self.bottom_root, other.bottom_root
													while i or j:
																			if i and ((not j) or i.left_tree_size < j.left_tree_size):
																									combined_roots_list.append((i, True) )
																									UpperCAmelCase_      :   int      =	i.parent
																			else:
																									combined_roots_list.append((j, False) )
																									UpperCAmelCase_      :   int      =	j.parent
        # Insert links between them
													for i in range(len(__magic_name__ ) - 1 ):
																			if combined_roots_list[i][1] != combined_roots_list[i + 1][1]:
																									UpperCAmelCase_      :   int      =	combined_roots_list[i + 1][0]
																									UpperCAmelCase_      :   Dict      =	combined_roots_list[i][0]
        # Consecutively merge roots with same left_tree_size
													UpperCAmelCase_      :   Any      =	combined_roots_list[0][0]
													while i.parent:
																			if (
																			    (i.left_tree_size == i.parent.left_tree_size) and (not i.parent.parent)
																			) or (
																			    i.left_tree_size == i.parent.left_tree_size
																			    and i.left_tree_size != i.parent.parent.left_tree_size
																			):
																									# Neighbouring Nodes
																									UpperCAmelCase_      :   Dict      =	i.left
																									UpperCAmelCase_      :   Optional[int]      =	i.parent.parent

																									# Merging trees
																									UpperCAmelCase_      :   Any      =	i.merge_trees(i.parent )

																									# Updating links
																									UpperCAmelCase_      :   Any      =	previous_node
																									UpperCAmelCase_      :   Any      =	next_node
																									if previous_node:
																															UpperCAmelCase_      :   Optional[int]      =	i
																									if next_node:
																															UpperCAmelCase_      :   Union[str, Any]      =	i
																			else:
																									UpperCAmelCase_      :   Tuple      =	i.parent
        # Updating self.bottom_root
													while i.left:
																			UpperCAmelCase_      :   int      =	i.left
													UpperCAmelCase_      :   int      =	i

													# Update other
													UpperCAmelCase_      :   Dict      =	self.size
													UpperCAmelCase_      :   Optional[Any]      =	self.bottom_root
													UpperCAmelCase_      :   int      =	self.min_node

													# Return the merged heap
													return self

							def      UpperCAmelCase__						(				self				:  Any							,  __magic_name__				:  Optional[int] )       ->							Dict:







													"""simple docstring"""
													if self.size == 0:
																			UpperCAmelCase_      :   Optional[int]      =	Node(__magic_name__ )
																			UpperCAmelCase_      :   Optional[Any]      =	1
																			UpperCAmelCase_      :   str      =	self.bottom_root
													else:
																			# Create new node
																			UpperCAmelCase_      :   Tuple      =	Node(__magic_name__ )

																			# Update size
																			self.size += 1

																			# update min_node
																			if val < self.min_node.val:
																									UpperCAmelCase_      :   Union[str, Any]      =	new_node
																			# Put new_node as a bottom_root in heap
																			UpperCAmelCase_      :   str      =	new_node
																			UpperCAmelCase_      :   List[Any]      =	self.bottom_root
																			UpperCAmelCase_      :   Union[str, Any]      =	new_node

																			# Consecutively merge roots with same left_tree_size
																			while (
																			    self.bottom_root.parent
																			    and self.bottom_root.left_tree_size
																			    == self.bottom_root.parent.left_tree_size
																			):
																									# Next node
																									UpperCAmelCase_      :   Union[str, Any]      =	self.bottom_root.parent.parent

																									# Merge
																									UpperCAmelCase_      :   List[str]      =	self.bottom_root.merge_trees(self.bottom_root.parent )

																									# Update Links
																									UpperCAmelCase_      :   List[Any]      =	next_node
																									UpperCAmelCase_      :   Tuple      =	None
																									if next_node:
																															UpperCAmelCase_      :   List[str]      =	self.bottom_root

							def      UpperCAmelCase__						(				self				:  Optional[Any] )       ->							int:







													"""simple docstring"""
													return self.min_node.val

							def      UpperCAmelCase__						(				self				:  Tuple )       ->							int:







													"""simple docstring"""
													return self.size == 0

							def      UpperCAmelCase__						(				self				:  str )       ->							Dict:







													"""simple docstring"""
													UpperCAmelCase_      :   Optional[Any]      =	self.min_node.val

													# Last element in heap corner case
													if self.size == 1:
																			# Update size
																			UpperCAmelCase_      :   List[Any]      =	0

																			# Update bottom root
																			UpperCAmelCase_      :   List[Any]      =	None

																			# Update min_node
																			UpperCAmelCase_      :   Union[str, Any]      =	None

																			return min_value
													# No right subtree corner case
													# The structure of the tree implies that this should be the bottom root
													# and there is at least one other root
													if self.min_node.right is None:
																			# Update size
																			self.size -= 1

																			# Update bottom root
																			UpperCAmelCase_      :   Any      =	self.bottom_root.parent
																			UpperCAmelCase_      :   str      =	None

																			# Update min_node
																			UpperCAmelCase_      :   Dict      =	self.bottom_root
																			UpperCAmelCase_      :   Tuple      =	self.bottom_root.parent
																			while i:
																									if i.val < self.min_node.val:
																															UpperCAmelCase_      :   Union[str, Any]      =	i
																									UpperCAmelCase_      :   Any      =	i.parent
																			return min_value
													# General case
													# Find the BinomialHeap of the right subtree of min_node
													UpperCAmelCase_      :   Dict      =	self.min_node.right
													UpperCAmelCase_      :   int      =	None
													UpperCAmelCase_      :   List[Any]      =	bottom_of_new
													UpperCAmelCase_      :   str      =	1

													# Size, min_node and bottom_root
													while bottom_of_new.left:
																			UpperCAmelCase_      :   int      =	size_of_new * 2 + 1
																			UpperCAmelCase_      :   List[str]      =	bottom_of_new.left
																			if bottom_of_new.val < min_of_new.val:
																									UpperCAmelCase_      :   Dict      =	bottom_of_new
        # Corner case of single root on top left path
													if (not self.min_node.left) and (not self.min_node.parent):
																			UpperCAmelCase_      :   List[str]      =	size_of_new
																			UpperCAmelCase_      :   Union[str, Any]      =	bottom_of_new
																			UpperCAmelCase_      :   Dict      =	min_of_new
																			# print("Single root, multiple nodes case")
																			return min_value
													# Remaining cases
													# Construct heap of right subtree
													UpperCAmelCase_      :   Union[str, Any]      =	BinomialHeap(
													    bottom_root=__magic_name__							,  min_node=__magic_name__							,  heap_size=__magic_name__ )

													# Update size
													UpperCAmelCase_      :   List[str]      =	self.size - 1 - size_of_new

													# Neighbour nodes
													UpperCAmelCase_      :   Union[str, Any]      =	self.min_node.left
													UpperCAmelCase_      :   str      =	self.min_node.parent

													# Initialize new bottom_root and min_node
													UpperCAmelCase_      :   List[Any]      =	previous_node or next_node
													UpperCAmelCase_      :   Union[str, Any]      =	next_node

													# Update links of previous_node and search below for new min_node and
													# bottom_root
													if previous_node:
																			UpperCAmelCase_      :   Any      =	next_node

																			# Update bottom_root and search for min_node below
																			UpperCAmelCase_      :   int      =	previous_node
																			UpperCAmelCase_      :   Union[str, Any]      =	previous_node
																			while self.bottom_root.left:
																									UpperCAmelCase_      :   List[str]      =	self.bottom_root.left
																									if self.bottom_root.val < self.min_node.val:
																															UpperCAmelCase_      :   str      =	self.bottom_root
													if next_node:
																			UpperCAmelCase_      :   str      =	previous_node

																			# Search for new min_node above min_node
																			UpperCAmelCase_      :   str      =	next_node
																			while i:
																									if i.val < self.min_node.val:
																															UpperCAmelCase_      :   Any      =	i
																									UpperCAmelCase_      :   Optional[Any]      =	i.parent
        # Merge heaps
													self.merge_heaps(__magic_name__ )

													return min_value

							def      UpperCAmelCase__						(				self				:  List[Any] )       ->							Optional[int]:







													"""simple docstring"""
													UpperCAmelCase_      :   Tuple      =	self.bottom_root
													while top_root.parent:
																			UpperCAmelCase_      :   List[Any]      =	top_root.parent
													# preorder
													UpperCAmelCase_      :   int      =	[]
													self.__traversal(__magic_name__							,  __magic_name__ )
													return heap_pre_order

							def      UpperCAmelCase__						(				self				:  Tuple							,  __magic_name__				:  Union[str, Any]							,  __magic_name__				:  Dict							,  __magic_name__				:  int=0 )       ->							Optional[Any]:







													"""simple docstring"""
													if curr_node:
																			preorder.append((curr_node.val, level) )
																			self.__traversal(curr_node.left							,  __magic_name__							,  level + 1 )
																			self.__traversal(curr_node.right							,  __magic_name__							,  level + 1 )
													else:
																			preorder.append(('''#''', level) )



							def __str__(				self				:  Optional[Any] )       ->							Any:







													"""simple docstring"""
													if self.is_empty():
																			return ""
													UpperCAmelCase_      :   Any      =	self.pre_order()

													return "\n".join(('''-''' * level + str(__magic_name__ )) for value, level in preorder_heap )


# Unit Tests
if __name__ == "__main__":
					import doctest

					doctest.testmod()









import math






def 	lowerCamelCase_       (			_a			):




		"""simple docstring"""






		if 1 < number < 4:
				# 2 and 3 are primes
				return True
		elif number < 2 or number % 2 == 0 or number % 3 == 0:
				# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
				return False

		# All primes number are in format of 6k +/- 1
		for i in range(5      ,  int(math.sqrt(_a			) + 1			)      ,  6			):
				if number % i == 0 or number % (i + 2) == 0:
						return False
		return True






def 	lowerCamelCase_       (			_a = 1_000      ,  _a = 1_000			):




		"""simple docstring"""






		lowerCAmelCase__  :     Union[str, Any]       	=   [0, 0, 0]  # length, a, b
		for a in range((a_limit * -1) + 1      ,  _a			):
				for b in range(2      ,  _a			):
						if is_prime(_a			):
								lowerCAmelCase__  :     str       	=   0
								lowerCAmelCase__  :     int       	=   0
								while is_prime((n**2) + (a * n) + b			):
										count += 1
										n += 1
								if count > longest[0]:
										lowerCAmelCase__  :     Dict       	=   [count, a, b]
		lowerCAmelCase__  :     int       	=   longest[1] * longest[2]
		return ans


if __name__ == "__main__":
		print(solution(1000, 1000))




