"""simple docstring"""




import copy
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Optional, Union

@dataclass
class       a_      :
					UpperCamelCase_ :	Optional[Union[str, Path]]			=    None
					UpperCamelCase_ :	bool			=    False
					UpperCamelCase_ :	bool			=    False
					UpperCamelCase_ :	bool			=    False
					UpperCamelCase_ :	Optional[Dict]			=    None
					UpperCamelCase_ :	Optional[str]			=    None
					UpperCamelCase_ :	bool			=    False
					UpperCamelCase_ :	bool			=    False
					UpperCamelCase_ :	bool			=    False
					UpperCamelCase_ :	bool			=    True
					UpperCamelCase_ :	Optional[int]			=    None
					UpperCamelCase_ :	int			=    1
					UpperCamelCase_ :	Optional[Union[str, bool]]			=    None
					UpperCamelCase_ :	bool			=    False
					UpperCamelCase_ :	Optional[Dict]			=    None
					UpperCamelCase_ :	Optional[str]			=    None




					def 						_SCREAMING_SNAKE_CASE						(	self						:     str     ):
							return self.__class__(**{k: copy.deepcopy(snake_case__     ) for k, v in self.__dict__.items()}     )





"""simple docstring"""




import os







def 							_UpperCAmelCase		(       ):





		"""simple docstring"""




		lowerCAmelCase__        =   os.path.dirname(os.path.realpath(lowerCamelCase__     )     )
		lowerCAmelCase__        =   os.path.join(lowerCamelCase__			,  """triangle.txt"""     )

		with open(lowerCamelCase__     ) as f:
				lowerCAmelCase__        =   f.readlines()

		lowerCAmelCase__        =   []
		for line in triangle:
				lowerCAmelCase__        =   []
				for number in line.strip().split(""" """     ):
						numbers_from_line.append(int(lowerCamelCase__     )     )
				a.append(lowerCamelCase__     )

		for i in range(1			,  len(lowerCamelCase__     )     ):
				for j in range(len(a[i]     )     ):
						lowerCAmelCase__        =   a[i - 1][j] if j != len(a[i - 1]     ) else 0
						lowerCAmelCase__        =   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())




