





import os






def 					SCREAMING_SNAKE_CASE__				(							UpperCamelCase__:				str = "input.txt"     ):

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

		SCREAMING_SNAKE_CASE__								=   len(UpperCamelCase__     )
		SCREAMING_SNAKE_CASE__								=   len(matrix[0]     )

		SCREAMING_SNAKE_CASE__								=   [[-1 for _ in range(UpperCamelCase__     )] for _ in range(UpperCamelCase__     )]
		for i in range(UpperCamelCase__     ):
				SCREAMING_SNAKE_CASE__								=   matrix[i][0]

		for j in range(1       , UpperCamelCase__     ):
				for i in range(UpperCamelCase__     ):
						SCREAMING_SNAKE_CASE__								=   minimal_path_sums[i][j - 1] + matrix[i][j]

				for i in range(1       , UpperCamelCase__     ):
						SCREAMING_SNAKE_CASE__								=   min(
						    minimal_path_sums[i][j]       , minimal_path_sums[i - 1][j] + matrix[i][j]     )

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


from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
__snake_case				:      Optional[Any]   		=			10


def 					_UpperCAmelCase				(						a__  ,	a__  ,	a__  ,	a__):

			'''simple docstring'''



			for i in range(a__  ,	a__):
						if array[i] == target:
									return i
			return -1


def 					_UpperCAmelCase				(						a__  ,	a__):

			'''simple docstring'''



			a_						:						Any 							= 0
			a_						:						List[str] 							= len(a__)
			while left <= right:
						if right - left < precision:
									return lin_search(a__  ,	a__  ,	a__  ,	a__)

						a_						:						Dict 							= (left + right) // 3 + 1
						a_						:						Optional[Any] 							= 2 * (left + right) // 3 + 1

						if array[one_third] == target:
									return one_third
						elif array[two_third] == target:
									return two_third

						elif target < array[one_third]:
									a_						:						int 							= one_third - 1
						elif array[two_third] < target:
									a_						:						Any 							= two_third + 1

						else:
									a_						:						Optional[int] 							= one_third + 1
									a_						:						int 							= two_third - 1
			else:
						return -1


def 					_UpperCAmelCase				(						a__  ,	a__  ,	a__  ,	a__):

			'''simple docstring'''



			if left < right:
						if right - left < precision:
									return lin_search(a__  ,	a__  ,	a__  ,	a__)
						a_						:						Optional[int] 							= (left + right) // 3 + 1
						a_						:						Union[str, Any] 							= 2 * (left + right) // 3 + 1

						if array[one_third] == target:
									return one_third
						elif array[two_third] == target:
									return two_third

						elif target < array[one_third]:
									return rec_ternary_search(a__  ,	one_third - 1  ,	a__  ,	a__)
						elif array[two_third] < target:
									return rec_ternary_search(two_third + 1  ,	a__  ,	a__  ,	a__)
						else:
									return rec_ternary_search(one_third + 1  ,	two_third - 1  ,	a__  ,	a__)
			else:
						return -1


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	__snake_case				:      Optional[int]   		=			input("""Enter numbers separated by comma:\n""").strip()
	__snake_case				:      Optional[int]   		=			[int(item.strip()) for item in user_input.split(""",""")]
	assert collection == sorted(collection), F"List must be ordered.\n{collection}."
	__snake_case				:      int   		=			int(input("""Enter the number to be found in the list:\n""").strip())
	__snake_case				:      List[Any]   		=			ite_ternary_search(collection, target)
	__snake_case				:      Optional[int]   		=			rec_ternary_search(0, len(collection) - 1, collection, target)
	if resulta != -1:
		print(F"""Iterative search: {target} found at positions: {resulta}""")
		print(F"""Recursive search: {target} found at positions: {resulta}""")
	else:
		print("""Not found""")


