
'''simple docstring'''





import math






class 							UpperCAmelCase_							:

 '''simple docstring'''







 def __init__(					self		:  Any			,				snake_case__		:  Optional[Any]=0 ):  # a graph with Node 0,1,...,N-1



   '''simple docstring'''




   UpperCAmelCase__      :					int				       =							n
   UpperCAmelCase__      :					Tuple				       =							[
       [math.inf for j in range(0			,				snake_case__ )] for i in range(0			,				snake_case__ )
   ]  # adjacency matrix for weight
   UpperCAmelCase__      :					int				       =							[
       [math.inf for j in range(0			,				snake_case__ )] for i in range(0			,				snake_case__ )
   ]  # dp[i][j] stores minimum distance from i to j







 def 							UpperCamelCase  (					self		:  Optional[int]			,				snake_case__		:  Tuple			,				snake_case__		:  Optional[int]			,				snake_case__		:  Union[str, Any] ):



   '''simple docstring'''




   UpperCAmelCase__      :					Optional[Any]				       =							w







 def 							UpperCamelCase  (					self		:  int ):



   '''simple docstring'''




   for k in range(0			,				self.n ):
     for i in range(0			,				self.n ):
       for j in range(0			,				self.n ):
         UpperCAmelCase__      :					int				       =							min(self.dp[i][j]			,				self.dp[i][k] + self.dp[k][j] )







 def 							UpperCamelCase  (					self		:  Union[str, Any]			,				snake_case__		:  Tuple			,				snake_case__		:  Tuple ):



   '''simple docstring'''




   return self.dp[u][v]


if __name__ == "__main__":
      SCREAMING_SNAKE_CASE     =       Graph(5)
      graph.add_edge(0, 2, 9)
      graph.add_edge(0, 4, 1_0)
      graph.add_edge(1, 3, 5)
      graph.add_edge(2, 3, 7)
      graph.add_edge(3, 0, 1_0)
      graph.add_edge(3, 1, 2)
      graph.add_edge(3, 2, 1)
      graph.add_edge(3, 4, 6)
      graph.add_edge(4, 1, 3)
      graph.add_edge(4, 2, 4)
      graph.add_edge(4, 3, 9)
      graph.floyd_warshall()
      graph.show_min(1, 4)
      graph.show_min(0, 3)





'''simple docstring'''





import operator as op







def snake_case_     (					lowercase__		):
  UpperCAmelCase__      :					Optional[Any]				       =							[]
  UpperCAmelCase__      :					Any				       =							lambda lowercase__   ,       lowercase__		: int(x / y		)  # noqa: E731 integer division operation
  UpperCAmelCase__      :					Any				       =							{
      "^": op.pow,
      "*": op.mul,
      "/": div,
      "+": op.add,
      "-": op.sub,
  }  # operators & their respective operation

  # print table header
  print("Symbol".center(8		)   ,       "Action".center(1_2		)   ,       "Stack"   ,       sep=" | "		)
  print("-" * (3_0 + len(lowercase__		))		)

  for x in post_fix:
    if x.isdigit():  # if x in digit
      stack.append(lowercase__		)  # append x to stack
      # output in tabular format
      print(x.rjust(8		)   ,       ("push(" + x + ")").ljust(1_2		)   ,       ",".join(lowercase__		)   ,       sep=" | "		)
    else:
      UpperCAmelCase__      :					str				       =							stack.pop()  # pop stack
      # output in tabular format
      print("".rjust(8		)   ,       ("pop(" + b + ")").ljust(1_2		)   ,       ",".join(lowercase__		)   ,       sep=" | "		)

      UpperCAmelCase__      :					List[Any]				       =							stack.pop()  # pop stack
      # output in tabular format
      print("".rjust(8		)   ,       ("pop(" + a + ")").ljust(1_2		)   ,       ",".join(lowercase__		)   ,       sep=" | "		)

      stack.append(
          str(opr[x](int(lowercase__		)   ,       int(lowercase__		)		)		)		)  # evaluate the 2 values popped from stack & push result to stack
      # output in tabular format
      print(
          x.rjust(8		)   ,       ("push(" + a + x + b + ")").ljust(1_2		)   ,       ",".join(lowercase__		)   ,       sep=" | "   ,       )

  return int(stack[0]		)


if __name__ == "__main__":
      SCREAMING_SNAKE_CASE     =       input("""\n\nEnter a Postfix Equation (space separated) = """).split(""" """)
      print("""\n\tResult = """, solve(Postfix))



