






'''simple docstring'''

import operator as op
def     __lowercase  (_lowercase     )   ->     Optional[Any]:


					"""simple docstring"""
					__lowerCamelCase						:       Tuple				   =				[]
					__lowerCamelCase						:       int				   =				lambda _lowercase,						_lowercase     : int(x / y     )  # noqa: E731 integer division operation
					__lowerCamelCase						:       str				   =				{
					    """^""": op.pow,
					    """*""": op.mul,
					    """/""": div,
					    """+""": op.add,
					    """-""": op.sub,
					}  # operators & their respective operation

					# print table header
					print("""Symbol""".center(8     ),						"""Action""".center(12     ),						"""Stack""",						sep=""" | """     )
					print("""-""" * (30 + len(__lowerCAmelCase     ))     )

					for x in post_fix:
										if x.isdigit():  # if x in digit
															stack.append(__lowerCAmelCase     )  # append x to stack
															# output in tabular format
															print(x.rjust(8     ),						("""push(""" + x + """)""").ljust(12     ),						""",""".join(__lowerCAmelCase     ),						sep=""" | """     )
										else:
															__lowerCamelCase						:       Dict				   =				stack.pop()  # pop stack
															# output in tabular format
															print("""""".rjust(8     ),						("""pop(""" + b + """)""").ljust(12     ),						""",""".join(__lowerCAmelCase     ),						sep=""" | """     )

															__lowerCamelCase						:       Any				   =				stack.pop()  # pop stack
															# output in tabular format
															print("""""".rjust(8     ),						("""pop(""" + a + """)""").ljust(12     ),						""",""".join(__lowerCAmelCase     ),						sep=""" | """     )

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

					return int(stack[0]     )


if __name__ == "__main__":
			UpperCAmelCase__						:Optional[Any]          =			input("""\n\nEnter a Postfix Equation (space separated) = """).split(""" """)
			print("""\n\tResult = """, solve(Postfix))











'''simple docstring'''

from __future__ import annotations

from typing import Any
def     __lowercase  (_lowercase     )   ->     int:


     """simple docstring"""
     if not postfix_notation:
          return 0

     __lowerCamelCase						:       Optional[int]				   =				{"""+""", """-""", """*""", """/"""}
     __lowerCamelCase						:       list[Any]				   =				[]

     for token in postfix_notation:
          if token in operations:
               __lowerCamelCase   ,      __lowerCamelCase						:       List[Any]				   =				stack.pop(), stack.pop()
               if token == "+":
                    stack.append(a + b     )
               elif token == "-":
                    stack.append(a - b     )
               elif token == "*":
                    stack.append(a * b     )
               else:
                    if a * b < 0 and a % b != 0:
                         stack.append(a // b + 1     )
                    else:
                         stack.append(a // b     )
          else:
               stack.append(int(_lowercase     )     )

     return stack.pop()


if __name__ == "__main__":
   import doctest

   doctest.testmod()



