import os





def   lowerCAmelCase_ (				)->  Tuple:






      '''simple docstring'''





      UpperCAmelCase    : Any      =os.path.dirname(os.path.realpath(__lowerCAmelCase						)						)
      UpperCAmelCase    : List[Any]      =os.path.join(__lowerCAmelCase		,					'''triangle.txt'''						)

      with open(__lowerCAmelCase						) as f:
            UpperCAmelCase    : Optional[int]      =f.readlines()

      UpperCAmelCase    : Union[str, Any]      =[[int(__lowerCAmelCase						) for y in x.rstrip('''\r\n'''						).split(''' '''						)] for x in triangle]

      for i in range(1		,					len(__lowerCAmelCase						)						):
            for j in range(len(a[i]						)						):
                  UpperCAmelCase    : Optional[int]      =a[i - 1][j] if j != len(a[i - 1]						) else 0
                  UpperCAmelCase    : List[str]      =a[i - 1][j - 1] if j > 0 else 0
                  a[i][j] += max(__lowerCAmelCase		,					__lowerCAmelCase						)
      return max(a[-1]						)


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

import math





def   lowerCAmelCase_ (				__lowerCAmelCase						)->  list[int]:






      '''simple docstring'''





      if not isinstance(__lowerCAmelCase		,					__lowerCAmelCase						):
            UpperCAmelCase    : Union[str, Any]      =f'''Input value of [number={number}] must be an integer'''
            raise TypeError(__lowerCAmelCase						)
      if number < 1:
            UpperCAmelCase    : Dict      =f'''Input value of [number={number}] must be a positive integer'''
            raise ValueError(__lowerCAmelCase						)
      UpperCAmelCase    : Dict      =[number]
      while number != 1:
            if number % 2 == 0:
                  UpperCAmelCase    : Optional[Any]      =math.floor(math.sqrt(__lowerCAmelCase						)						)
            else:
                  UpperCAmelCase    : List[str]      =math.floor(
                      math.sqrt(__lowerCAmelCase						) * math.sqrt(__lowerCAmelCase						) * math.sqrt(__lowerCAmelCase						)						)
            sequence.append(__lowerCAmelCase						)
      return sequence


if __name__ == "__main__":
     import doctest

     doctest.testmod()
