





'''simple docstring'''






class  lowerCamelCase__				:


	"""simple docstring"""





	def __init__(					self			)       ->				Dict:
					_A :				Any				=  [0]
					_A :				int				=  0




	def 				_lowerCamelCase				(					self   ,     UpperCAmelCase__			)       ->				None:
					_A :				Dict				=  self.__heap[i]
					while i // 2 > 0:
									if self.__heap[i] > self.__heap[i // 2]:
													_A :				Union[str, Any]				=  self.__heap[i // 2]
													_A :				Union[str, Any]				=  temporary
									i //= 2




	def 				_lowerCamelCase				(					self   ,     UpperCAmelCase__			)       ->				None:
					self.__heap.append(lowerCamelCase__			)
					self.__size += 1
					self.__swap_up(self.__size			)




	def 				_lowerCamelCase				(					self   ,     UpperCAmelCase__			)       ->				None:


					while self.__size >= 2 * i:
									if 2 * i + 1 > self.__size:
													_A :				str				=  2 * i
									else:
													if self.__heap[2 * i] > self.__heap[2 * i + 1]:
																	_A :				Optional[int]				=  2 * i
													else:
																	_A :				Dict				=  2 * i + 1
									_A :				Any				=  self.__heap[i]
									if self.__heap[i] < self.__heap[bigger_child]:
													_A :				Optional[int]				=  self.__heap[bigger_child]
													_A :				Any				=  temporary
									_A :				Any				=  bigger_child




	def 				_lowerCamelCase				(					self			)       ->				int:
					_A :				List[str]				=  self.__heap[1]
					_A :				Tuple				=  self.__heap[self.__size]
					self.__size -= 1
					self.__heap.pop()
					self.__swap_down(1			)
					return max_value




	@property
	def 				_lowerCamelCase				(					self			)       ->				str:
					return self.__heap[1:]




	def __len__(					self			)       ->				str:
					return self.__size


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	# create an instance of BinaryHeap
	__UpperCamelCase      :   Optional[int]								=     BinaryHeap()
	binary_heap.insert(6)
	binary_heap.insert(10)
	binary_heap.insert(15)
	binary_heap.insert(12)
	# pop root(max-values because it is max heap)
	print(binary_heap.pop())  # 15
	print(binary_heap.pop())  # 12
	# get the list and size after operations
	print(binary_heap.get_list)
	print(len(binary_heap))







import os



def   __lowercase  ( )					->  int:


      '''simple docstring'''


      SCREAMING_SNAKE_CASE						=		os.path.dirname(os.path.realpath(_SCREAMING_SNAKE_CASE      )      )
      SCREAMING_SNAKE_CASE						=		os.path.join(_SCREAMING_SNAKE_CASE					,		"""triangle.txt"""      )

      with open(_SCREAMING_SNAKE_CASE      ) as in_file:
            SCREAMING_SNAKE_CASE						=		[[int(_SCREAMING_SNAKE_CASE      ) for i in line.split()] for line in in_file]

      while len(_SCREAMING_SNAKE_CASE      ) != 1:
            SCREAMING_SNAKE_CASE						=		triangle.pop()
            SCREAMING_SNAKE_CASE						=		triangle[-1]
            for j in range(len(_SCREAMING_SNAKE_CASE      ) - 1      ):
                  curr_row[j] += max(last_row[j]					,		last_row[j + 1]      )
      return triangle[0][0]


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


