



from __future__ import annotations


def 		_UpperCAmelCase				(      snake_case	,						snake_case	,						snake_case			):





					"""simple docstring"""

					if len(snake_case			) == 0:
										raise ValueError("""find_max() arg is an empty sequence"""			)
					if (
					    left >= len(snake_case			)
					    or left < -len(snake_case			)
					    or right >= len(snake_case			)
					    or right < -len(snake_case			)
					):
										raise IndexError("""list index out of range"""			)
					if left == right:
										return nums[left]
					_lowerCAmelCase						=    (left + right) >> 1  # the middle
					_lowerCAmelCase						=    find_max(snake_case	,						snake_case	,						snake_case			)  # find max in range[left, mid]
					_lowerCAmelCase						=    find_max(snake_case	,						mid + 1	,						snake_case			)  # find max in range[mid + 1, right]

					return left_max if left_max >= right_max else right_max


if __name__ == "__main__":
	import doctest

	doctest.testmod(verbose=True)




'''simple docstring'''




import os




def 							lowerCamelCase	(      UpperCAmelCase__       :					str = "input.txt" )			->      int:

							with open(os.path.join(os.path.dirname(UpperCAmelCase__ )      ,      UpperCAmelCase__ ) ) as input_file:
														lowercase_					:			str										=       [
														    [int(UpperCAmelCase__ ) for element in line.split(""",""" )]
														    for line in input_file.readlines()
														]

							lowercase_					:			Optional[Any]										=       len(UpperCAmelCase__ )
							lowercase_					:			Any										=       len(matrix[0] )

							lowercase_					:			Union[str, Any]										=       [[-1 for _ in range(UpperCAmelCase__ )] for _ in range(UpperCAmelCase__ )]
							for i in range(UpperCAmelCase__ ):
														lowercase_					:			int										=       matrix[i][0]

							for j in range(1      ,      UpperCAmelCase__ ):
														for i in range(UpperCAmelCase__ ):
																					lowercase_					:			Union[str, Any]										=       minimal_path_sums[i][j - 1] + matrix[i][j]

														for i in range(1      ,      UpperCAmelCase__ ):
																					lowercase_					:			Tuple										=       min(
																					    minimal_path_sums[i][j]      ,      minimal_path_sums[i - 1][j] + matrix[i][j] )

														for i in range(rows - 2      ,      -1      ,      -1 ):
																					lowercase_					:			Dict										=       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() = }""")





