


import os

def 	_a     ( SCREAMING_SNAKE_CASE		: str = "input.txt"   ):







 """simple docstring"""



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

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

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

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

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

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



'''simple docstring'''




def 							lowerCamelCase	(      UpperCAmelCase__       :					int      ,      UpperCAmelCase__       :					int )			->      bool:
							return numa ^ numa < 0


if __name__ == "__main__":
						import doctest

						doctest.testmod()





