
"""simple docstring"""







from __future__ import annotations
def    __lowerCAmelCase    (_UpperCamelCase		):
	__lowerCAmelCase      :						List[str]						      =				2
	__lowerCAmelCase      :						Any						      =				[]
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(_UpperCamelCase		)
	if n > 1:
		factors.append(_UpperCamelCase		)
	return factors


if __name__ == "__main__":
							import doctest

							doctest.testmod()

"""simple docstring"""







import os
def    __lowerCAmelCase    (_UpperCamelCase = "input.txt"		):

	with open(os.path.join(os.path.dirname(_UpperCamelCase		)	,  _UpperCamelCase		)		) as input_file:
		__lowerCAmelCase      :						Optional[Any]						      =				[
		    [int(_UpperCamelCase		) for element in line.split(','		)]
		    for line in input_file.readlines()
		]

	__lowerCAmelCase      :						List[str]						      =				len(_UpperCamelCase		)
	__lowerCAmelCase      :						Tuple						      =				len(matrix[0]		)

	__lowerCAmelCase      :						int						      =				[[-1 for _ in range(_UpperCamelCase		)] for _ in range(_UpperCamelCase		)]
	for i in range(_UpperCamelCase		):
		__lowerCAmelCase      :						Any						      =				matrix[i][0]

	for j in range(1	,  _UpperCamelCase		):
		for i in range(_UpperCamelCase		):
			__lowerCAmelCase      :						Optional[Any]						      =				minimal_path_sums[i][j - 1] + matrix[i][j]

		for i in range(1	,  _UpperCamelCase		):
			__lowerCAmelCase      :						Optional[Any]						      =				min(
			    minimal_path_sums[i][j]	,  minimal_path_sums[i - 1][j] + matrix[i][j]		)

		for i in range(rows - 2	,  -1	,  -1		):
			__lowerCAmelCase      :						List[str]						      =				min(
			    minimal_path_sums[i][j]	,  minimal_path_sums[i + 1][j] + matrix[i][j]		)

	return min(minimal_path_sums_row[-1] for minimal_path_sums_row in minimal_path_sums		)


if __name__ == "__main__":
							print(f'{solution() = }')