


import os




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

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

   __a					=  len(lowerCAmelCase__   )
   __a					=  len(matrix[0]   )

   __a					=  [[-1 for _ in range(lowerCAmelCase__   )] for _ in range(lowerCAmelCase__   )]
   for i in range(lowerCAmelCase__   ):
      __a					=  matrix[i][0]

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

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

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

def a__       (			A_,	A_,	A_,	A_   ):






  '''simple docstring'''





  if (direction == 1 and array[indexa] > array[indexa]) or (
      direction == 0 and array[indexa] < array[indexa]
  ):
    __magic_name__	,       __magic_name__								=			array[indexa], array[indexa]

def a__       (			A_,	A_,	A_,	A_   ):






  '''simple docstring'''





  if length > 1:
    __magic_name__								=			int(length / 2   )
    for i in range(A_,	low + middle   ):
      comp_and_swap(A_,	A_,	i + middle,	A_   )
    bitonic_merge(A_,	A_,	A_,	A_   )
    bitonic_merge(A_,	low + middle,	A_,	A_   )

def a__       (			A_,	A_,	A_,	A_   ):






  '''simple docstring'''





  if length > 1:
    __magic_name__								=			int(length / 2   )
    bitonic_sort(A_,	A_,	A_,	1   )
    bitonic_sort(A_,	low + middle,	A_,	0   )
    bitonic_merge(A_,	A_,	A_,	A_   )


if __name__ == "__main__":
    __lowerCAmelCase     :	Optional[Any]       			=  input('Enter numbers separated by a comma:\n').strip()
    __lowerCAmelCase     :	List[Any]       			=  [int(item.strip()) for item in user_input.split(',')]

    bitonic_sort(unsorted, 0, len(unsorted), 1)
    print('\nSorted array in ascending order is: ', end='')
    print(*unsorted, sep=', ')

    bitonic_merge(unsorted, 0, len(unsorted), 0)
    print('Sorted array in descending order is: ', end='')
    print(*unsorted, sep=', ')

