
'''simple docstring'''



import os


def A      ():
						_lowerCAmelCase  						= os.path.dirname(os.path.realpath(__lowerCamelCase		)		)
						_lowerCAmelCase  						= os.path.join(__lowerCamelCase ,	"""triangle.txt"""		)

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

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



from __future__ import annotations

SCREAMING_SNAKE_CASE_						=					'Alexander Joslin'

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int       )      ->				int:

				if number <= 0:
								_UpperCAmelCase				:						Optional[Any]       						=			F'n must be greater than 0. Got n = {number}'
								raise ValueError(lowerCAmelCase       )

				_UpperCAmelCase				:						Dict       						=			[number + 1] * (number + 1)

				# starting position
				_UpperCAmelCase				:						Dict       						=			0
				for i in range(1     ,					lowerCAmelCase       ):
								_UpperCAmelCase				:						int       						=			min(table[i + 1]     ,					table[i] + 1       )
								# check if out of bounds
								if i * 2 <= number:
												_UpperCAmelCase				:						int       						=			min(table[i * 2]     ,					table[i] + 1       )
								# check if out of bounds
								if i * 3 <= number:
												_UpperCAmelCase				:						int       						=			min(table[i * 3]     ,					table[i] + 1       )
				return table[number]


if __name__ == "__main__":
					import doctest

					doctest.testmod()


