



import os

def     __lowercase(	UpperCAmelCase__ = "input.txt" ):


      """simple docstring"""



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

      lowerCamelCase								=		len(UpperCAmelCase__ )
      lowerCamelCase								=		len(matrix[0] )

      lowerCamelCase								=		[[-1 for _ in range(UpperCAmelCase__ )] for _ in range(UpperCAmelCase__ )]
      for i in range(UpperCAmelCase__ ):
            lowerCamelCase								=		matrix[i][0]

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

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

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








def     __lowercase(	UpperCAmelCase__ ):


      """simple docstring"""



      lowerCamelCase								=		[]
      lowerCamelCase								=		[]
      lowerCamelCase								=		{
          "^": 3,
          "*": 2,
          "/": 2,
          "%": 2,
          "+": 1,
          "-": 1,
      }  # Priority of each operator
      lowerCamelCase								=		len(UpperCAmelCase__ ) if (len(UpperCAmelCase__ ) > 7) else 7

      # Print table header for output
      print(
          "Symbol".center(8 )   ,   "Stack".center(UpperCAmelCase__ )   ,   "Postfix".center(UpperCAmelCase__ )   ,   sep=" | "   ,   )
      print("-" * (print_width * 3 + 7) )

      for x in infix:
            if x.isalpha() or x.isdigit():
                  post_fix.append(UpperCAmelCase__ )  # if x is Alphabet / Digit, add it to Postfix
            elif x == "(":
                  stack.append(UpperCAmelCase__ )  # if x is "(" push to Stack
            elif x == ")":  # if x is ")" pop stack until "(" is encountered
                  while stack[-1] != "(":
                        post_fix.append(stack.pop() )  # Pop stack & add the content to Postfix
                  stack.pop()
            else:
                  if len(UpperCAmelCase__ ) == 0:
                        stack.append(UpperCAmelCase__ )  # If stack is empty, push x to stack
                  else:  # while priority of x is not > priority of element in the stack
                        while len(UpperCAmelCase__ ) > 0 and priority[x] <= priority[stack[-1]]:
                              post_fix.append(stack.pop() )  # pop stack & add to Postfix
                        stack.append(UpperCAmelCase__ )  # push x to stack

            print(
                x.center(8 )   ,   ("".join(UpperCAmelCase__ )).ljust(UpperCAmelCase__ )   ,   ("".join(UpperCAmelCase__ )).ljust(UpperCAmelCase__ )   ,   sep=" | "   ,   )  # Output in tabular format

      while len(UpperCAmelCase__ ) > 0:  # while stack is not empty
            post_fix.append(stack.pop() )  # pop stack & add to Postfix
            print(
                " ".center(8 )   ,   ("".join(UpperCAmelCase__ )).ljust(UpperCAmelCase__ )   ,   ("".join(UpperCAmelCase__ )).ljust(UpperCAmelCase__ )   ,   sep=" | "   ,   )  # Output in tabular format

      return "".join(UpperCAmelCase__ )  # return Postfix as str

def     __lowercase(	UpperCAmelCase__ ):


      """simple docstring"""



      lowerCamelCase								=		list(infix[::-1] )  # reverse the infix equation

      for i in range(len(UpperCAmelCase__ ) ):
            if infix[i] == "(":
                  lowerCamelCase								=		")"  # change "(" to ")"
            elif infix[i] == ")":
                  lowerCamelCase								=		"("  # change ")" to "("

      return (infix_2_postfix("".join(UpperCAmelCase__ ) ))[
          ::-1
      ]  # call infix_2_postfix on Infix, return reverse of Postfix


if __name__ == "__main__":
     a_						:     str	     =		input('\nEnter an Infix Equation = ')  # Input an Infix equation
     a_						:     List[Any]	     =		''.join(Infix.split())  # Remove spaces from the input
     print('\n\t', Infix, '(Infix) -> ', infix_2_prefix(Infix), '(Prefix)')