"""simple docstring"""







import os
def    __lowerCAmelCase    ():
	__lowerCAmelCase      :						str						      =				os.path.dirname(os.path.realpath(_UpperCamelCase		)		)
	__lowerCAmelCase      :						List[str]						      =				os.path.join(_UpperCamelCase	,  'triangle.txt'		)

	with open(_UpperCamelCase		) as f:
		__lowerCAmelCase      :						str						      =				f.readlines()

	__lowerCAmelCase      :						int						      =				[]
	for line in triangle:
		__lowerCAmelCase      :						int						      =				[]
		for number in line.strip().split(' '		):
			numbers_from_line.append(int(_UpperCamelCase		)		)
		a.append(_UpperCamelCase		)

	for i in range(1	,  len(_UpperCamelCase		)		):
		for j in range(len(a[i]		)		):
			__lowerCAmelCase      :						List[Any]						      =				a[i - 1][j] if j != len(a[i - 1]		) else 0
			__lowerCAmelCase      :						Optional[int]						      =				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"""







class 			A__	:

		def __init__(				self	,		_SCREAMING_SNAKE_CASE			):
			__lowerCAmelCase      :						List[Any]						      =				size
			__lowerCAmelCase      :						str						      =				[0] * size
			__lowerCAmelCase      :						Any						      =				[0] * size

		@staticmethod
		def 							__lowerCamelCase							(				_SCREAMING_SNAKE_CASE			):
			return index | (index + 1)

		@staticmethod
		def 							__lowerCamelCase							(				_SCREAMING_SNAKE_CASE			):
			return (index & (index + 1)) - 1

		def 							__lowerCamelCase							(				self	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE			):
			__lowerCAmelCase      :						Any						      =				value
			while index < self.size:
				__lowerCAmelCase      :						Dict						      =				self.get_prev(_SCREAMING_SNAKE_CASE			) + 1
				if current_left_border == index:
					__lowerCAmelCase      :						Any						      =				value
				else:
					__lowerCAmelCase      :						Any						      =				max(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE			)
				__lowerCAmelCase      :						List[Any]						      =				self.get_next(_SCREAMING_SNAKE_CASE			)







		def 							__lowerCamelCase							(				self	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE			):
			right -= 1  # Because of right is exclusive
			__lowerCAmelCase      :						Optional[int]						      =				0
			while left <= right:
				__lowerCAmelCase      :						Optional[int]						      =				self.get_prev(_SCREAMING_SNAKE_CASE			)
				if left <= current_left:
					__lowerCAmelCase      :						Optional[Any]						      =				max(_SCREAMING_SNAKE_CASE	,		self.tree[right]			)
					__lowerCAmelCase      :						Optional[Any]						      =				current_left
				else:
					__lowerCAmelCase      :						List[str]						      =				max(_SCREAMING_SNAKE_CASE	,		self.arr[right]			)
					right -= 1
			return result


if __name__ == "__main__":
							import doctest

							doctest.testmod()