






"""simple docstring"""







class 					lowerCamelCase__					:







    class 					lowerCamelCase__					:
        SCREAMING_SNAKE_CASE		=			'_prev', '_data', '_next'






        def __init__( self	,A	,A	,A					):
              UpperCAmelCase							=       link_p
              UpperCAmelCase							=       element
              UpperCAmelCase							=       link_n






        def 				_UpperCamelCase							( self					):
              return (
                  F''' Prev -> {self._prev is not None}, Next -> {self._next is not None}'''
              )







    def __init__( self					):
          UpperCAmelCase							=       self._Node(lowerCamelCase_	,lowerCamelCase_	,lowerCamelCase_					)
          UpperCAmelCase							=       self._Node(lowerCamelCase_	,lowerCamelCase_	,lowerCamelCase_					)
          UpperCAmelCase							=       self._trailer
          UpperCAmelCase							=       self._header
          UpperCAmelCase							=       0






    def __len__( self					):
          return self._size






    def 				_UpperCamelCase							( self					):
          return self.__len__() == 0






    def 				_UpperCamelCase							( self	,A	,A	,A					):
          UpperCAmelCase							=       self._Node(lowerCamelCase_	,lowerCamelCase_	,lowerCamelCase_					)
          UpperCAmelCase							=       new_node
          UpperCAmelCase							=       new_node
          self._size += 1
          return self






    def 				_UpperCamelCase							( self	,A					):
          UpperCAmelCase							=       node._prev
          UpperCAmelCase							=       node._next

          UpperCAmelCase							=       successor
          UpperCAmelCase							=       predecessor
          self._size -= 1
          UpperCAmelCase							=       node._data
          UpperCAmelCase							=       None
          del node
          return temp







class 					lowerCamelCase__					(       _DoublyLinkedBase ):






    def 				_UpperCamelCase							( self					):



          if self.is_empty():
                raise Exception("""List is empty"""					)
          return self._header._next._data






    def 				_UpperCamelCase							( self					):



          if self.is_empty():
                raise Exception("""List is empty"""					)
          return self._trailer._prev._data






    def 				_UpperCamelCase							( self	,A					):
          return self._insert(self._header	,lowerCamelCase_	,self._header._next					)






    def 				_UpperCamelCase							( self	,A					):
          return self._insert(self._trailer._prev	,lowerCamelCase_	,self._trailer					)






    def 				_UpperCamelCase							( self					):



          if self.is_empty():
                raise IndexError("""remove_first from empty list"""					)
          return self._delete(self._header._next					)






    def 				_UpperCamelCase							( self					):



          if self.is_empty():
                raise IndexError("""remove_first from empty list"""					)
          return self._delete(self._trailer._prev					)











"""simple docstring"""
import os






def        lowerCamelCase_  (						):
 lowerCamelCase__     :			List[Any]     				=						os.path.dirname(os.path.realpath(_lowerCamelCase				)				)
 lowerCamelCase__     :			Any     				=						os.path.join(_lowerCamelCase			,   'triangle.txt'				)

 with open(_lowerCamelCase				) as in_file:
  lowerCamelCase__     :			Dict     				=						[[int(_lowerCamelCase				) for i in line.split()] for line in in_file]

 while len(_lowerCamelCase				) != 1:
  lowerCamelCase__     :			Dict     				=						triangle.pop()
  lowerCamelCase__     :			Optional[Any]     				=						triangle[-1]
  for j in range(len(_lowerCamelCase				) - 1				):
   curr_row[j] += max(last_row[j]			,   last_row[j + 1]				)
 return triangle[0][0]


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

