'''simple docstring'''

from functools import lru_cache



@lru_cache
def  _lowerCAmelCase				(				__a      )  ->      int:
     '''simple docstring'''







     if not isinstance(lowerCAmelCase__			,      lowerCAmelCase__      ):
          raise TypeError("""k must be an integer."""      )
     if k < 0:
          raise ValueError("""k integer must be greater or equal to zero."""      )
     if k == 0:
          return 0
     elif k == 1:
          return 1
     else:
          return fibonacci(k - 1      ) + fibonacci(k - 2      )



def  _lowerCAmelCase				(				__a			,      __a      )  ->      int:
     '''simple docstring'''







     _UpperCamelCase  :Any       =len(lowerCAmelCase__      )
     # Find m such that F_m >= n where F_i is the i_th fibonacci number.
     _UpperCamelCase  :str       =0
     while True:
          if fibonacci(lowerCAmelCase__      ) >= len_list:
               _UpperCamelCase  :Dict       =i
               break
          i += 1
     _UpperCamelCase  :str       =0
     while fibb_k > 0:
          _UpperCamelCase  :Dict       =min(
              offset + fibonacci(fibb_k - 1      )			,      len_list - 1      )  # Prevent out of range
          _UpperCamelCase  :Any       =arr[index_k]
          if item_k_1 == val:
               return index_k
          elif val < item_k_1:
               fibb_k -= 1
          elif val > item_k_1:
               offset += fibonacci(fibb_k - 1      )
               fibb_k -= 2
     else:
          return -1


if __name__ == "__main__":
      import doctest

      doctest.testmod()



'''simple docstring'''






import os






def 						_A					() ->	int:




     '''simple docstring'''



     _a         =				os.path.dirname(os.path.realpath(lowerCAmelCase__		)		)
     _a         =				os.path.join(lowerCAmelCase__					,    'triangle.txt'		)

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

     while len(lowerCAmelCase__		) != 1:
          _a         =				triangle.pop()
          _a         =				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())

