


import os


def     lowercase	(    a = "input.txt" ):



		'''simple docstring'''




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

		SCREAMING_SNAKE_CASE_				:str				     =						len(__lowerCamelCase )
		SCREAMING_SNAKE_CASE_				:Dict				     =						len(matrix[0] )

		SCREAMING_SNAKE_CASE_				:str				     =						[[-1 for _ in range(__lowerCamelCase )] for _ in range(__lowerCamelCase )]
		for i in range(__lowerCamelCase ):
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						matrix[i][0]

		for j in range(1     , __lowerCamelCase ):
				for i in range(__lowerCamelCase ):
						SCREAMING_SNAKE_CASE_				:Dict				     =						minimal_path_sums[i][j - 1] + matrix[i][j]

				for i in range(1     , __lowerCamelCase ):
						SCREAMING_SNAKE_CASE_				:List[Any]				     =						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_				:List[Any]				     =						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() = }''')








'''simple docstring'''



from itertools import product


def A (__lowerCamelCase :int					,      __lowerCamelCase :int						):
						_lowerCAmelCase    		=					sides_number
						_lowerCAmelCase    		=					max_face_number * dice_number
						_lowerCAmelCase    		=					[0] * (max_total + 1)

						_lowerCAmelCase    		=					1
						_lowerCAmelCase    		=					range(__lowerCamelCase					,      max_face_number + 1						)
						for dice_numbers in product(__lowerCamelCase					,      repeat=__lowerCamelCase						):
												_lowerCAmelCase    		=					sum(__lowerCamelCase						)
												totals_frequencies[total] += 1

						return totals_frequencies


def A ():
						_lowerCAmelCase    		=					total_frequency_distribution(
						    sides_number=4					,      dice_number=9						)
						_lowerCAmelCase    		=					total_frequency_distribution(
						    sides_number=6					,      dice_number=6						)

						_lowerCAmelCase    		=					0
						_lowerCAmelCase    		=					9
						_lowerCAmelCase    		=					4 * 9
						_lowerCAmelCase    		=					6
						for peter_total in range(__lowerCamelCase					,      max_peter_total + 1						):
												peter_wins_count += peter_totals_frequencies[peter_total] * sum(
												    colin_totals_frequencies[min_colin_total:peter_total]						)

						_lowerCAmelCase    		=					(4**9) * (6**6)
						_lowerCAmelCase    		=					peter_wins_count / total_games_number

						_lowerCAmelCase    		=					round(__lowerCamelCase					,      ndigits=7						)

						return rounded_peter_win_probability


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