"""simple docstring"""







import os


def 	a__   (		)->						Optional[int]:
						UpperCAmelCase__       						=		os.path.dirname(os.path.realpath(UpperCAmelCase__      )      )
						UpperCAmelCase__       						=		os.path.join(UpperCAmelCase__		,      """triangle.txt"""      )

						with open(UpperCAmelCase__      ) as f:
												UpperCAmelCase__       						=		f.readlines()

						UpperCAmelCase__       						=		[[int(UpperCAmelCase__      ) for y in x.rstrip("""\r\n"""      ).split(""" """      )] for x in triangle]

						for i in range(1		,      len(UpperCAmelCase__      )      ):
												for j in range(len(a[i]      )      ):
																		UpperCAmelCase__       						=		a[i - 1][j] if j != len(a[i - 1]      ) else 0
																		UpperCAmelCase__       						=		a[i - 1][j - 1] if j > 0 else 0
																		a[i][j] += max(UpperCAmelCase__		,      UpperCAmelCase__      )
						return max(a[-1]      )


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


"""simple docstring"""







from __future__ import annotations


def 	a__   (		UpperCAmelCase__							:      list      )->						int | float:
						UpperCAmelCase__       						=		sorted(UpperCAmelCase__      )
						UpperCAmelCase__       						=		len(UpperCAmelCase__      )
						UpperCAmelCase__       						=		length >> 1
						return (
						    (sorted_list[mid_index] + sorted_list[mid_index - 1]) / 2
						    if length % 2 == 0
						    else sorted_list[mid_index]
						)


def 	a__   (		)->						Dict:
						import doctest

						doctest.testmod()


if __name__ == "__main__":
						main()

