


'''simple docstring'''


import operator as op






def  __lowerCAmelCase (__lowerCAmelCase   ):
		_UpperCAmelCase		:       Optional[Any]								=      []
		_UpperCAmelCase		:       List[Any]								=      lambda __lowerCAmelCase      , __lowerCAmelCase   : 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(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:
						_UpperCAmelCase		:       Any								=      stack.pop()  # pop stack
						# output in tabular format
						print("".rjust(8   )      , ("pop(" + b + ")").ljust(12   )      , ",".join(__lowerCAmelCase   )      , sep=" | "   )

						_UpperCAmelCase		:       Union[str, 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__":
						lowerCamelCase__    	=     input('\n\nEnter a Postfix Equation (space separated) = ').split(' ')
						print('\n\tResult = ', solve(Postfix))







'''simple docstring'''


from math import factorial






class 	lowerCAmelCase__			:




			def __init__(		self  :     int	,  lowerCamelCase__  :     Union[str, Any]	,  lowerCamelCase__  :     str )   ->Dict:



					'''simple docstring'''







					_UpperCAmelCase		:       Optional[Any]								=      real
					if isinstance(lowerCamelCase__	,  lowerCamelCase__ ):
							_UpperCAmelCase		:       Any								=      [1] * rank
					else:
							_UpperCAmelCase		:       Dict								=      rank




			def __repr__(		self  :     str )   ->List[str]:



					'''simple docstring'''







					return (
					    F"""{self.real}+"""
					    F"""{'+'.join(str(lowerCamelCase__ )+'E'+str(n+1 )for n,dual in enumerate(self.duals ) )}"""
					)




			def 							lowerCAmelCase__    (		self  :     Dict )   ->Tuple:



					'''simple docstring'''







					_UpperCAmelCase		:       Union[str, Any]								=      self.duals.copy()
					while cur[-1] == 0:
							cur.pop(-1 )
					return Dual(self.real	,  lowerCamelCase__ )




			def __add__(		self  :     Dict	,  lowerCamelCase__  :     List[Any] )   ->Any:



					'''simple docstring'''







					if not isinstance(lowerCamelCase__	,  lowerCamelCase__ ):
							return Dual(self.real + other	,  self.duals )
					_UpperCAmelCase		:       Optional[int]								=      self.duals.copy()
					_UpperCAmelCase		:       Optional[int]								=      other.duals.copy()
					if len(lowerCamelCase__ ) > len(lowerCamelCase__ ):
							o_dual.extend([1] * (len(lowerCamelCase__ ) - len(lowerCamelCase__ )) )
					elif len(lowerCamelCase__ ) < len(lowerCamelCase__ ):
							s_dual.extend([1] * (len(lowerCamelCase__ ) - len(lowerCamelCase__ )) )
					_UpperCAmelCase		:       Union[str, Any]								=      []
					for i in range(len(lowerCamelCase__ ) ):
							new_duals.append(s_dual[i] + o_dual[i] )
					return Dual(self.real + other.real	,  lowerCamelCase__ )

			lowerCAmelCase :	Tuple          =     __add__




			def __sub__(		self  :     List[Any]	,  lowerCamelCase__  :     Union[str, Any] )   ->Dict:



					'''simple docstring'''







					return self + other * -1




			def __mul__(		self  :     List[str]	,  lowerCamelCase__  :     Optional[Any] )   ->Union[str, Any]:



					'''simple docstring'''







					if not isinstance(lowerCamelCase__	,  lowerCamelCase__ ):
							_UpperCAmelCase		:       Optional[int]								=      []
							for i in self.duals:
									new_duals.append(i * other )
							return Dual(self.real * other	,  lowerCamelCase__ )
					_UpperCAmelCase		:       Union[str, Any]								=      [0] * (len(self.duals ) + len(other.duals ) + 1)
					for i, item in enumerate(self.duals ):
							for j, jtem in enumerate(other.duals ):
									new_duals[i + j + 1] += item * jtem
					for k in range(len(self.duals ) ):
							new_duals[k] += self.duals[k] * other.real
					for index in range(len(other.duals ) ):
							new_duals[index] += other.duals[index] * self.real
					return Dual(self.real * other.real	,  lowerCamelCase__ )

			lowerCAmelCase :	Union[str, Any]          =     __mul__




			def __truediv__(		self  :     Optional[Any]	,  lowerCamelCase__  :     List[Any] )   ->Union[str, Any]:



					'''simple docstring'''







					if not isinstance(lowerCamelCase__	,  lowerCamelCase__ ):
							_UpperCAmelCase		:       Union[str, Any]								=      []
							for i in self.duals:
									new_duals.append(i / other )
							return Dual(self.real / other	,  lowerCamelCase__ )
					raise ValueError




			def __floordiv__(		self  :     str	,  lowerCamelCase__  :     str )   ->List[str]:



					'''simple docstring'''







					if not isinstance(lowerCamelCase__	,  lowerCamelCase__ ):
							_UpperCAmelCase		:       Tuple								=      []
							for i in self.duals:
									new_duals.append(i // other )
							return Dual(self.real // other	,  lowerCamelCase__ )
					raise ValueError






			def __pow__(		self  :     Tuple	,  lowerCamelCase__  :     Optional[Any] )   ->Optional[int]:



					'''simple docstring'''







					if n < 0 or isinstance(lowerCamelCase__	,  lowerCamelCase__ ):
							raise ValueError("power must be a positive integer" )
					if n == 0:
							return 1
					if n == 1:
							return self
					_UpperCAmelCase		:       str								=      self
					for _ in range(n - 1 ):
							x *= self
					return x






def  __lowerCAmelCase (__lowerCAmelCase      , __lowerCAmelCase      , __lowerCAmelCase   ):
		if not callable(__lowerCAmelCase   ):
				raise ValueError("differentiate() requires a function as input for func"   )
		if not isinstance(__lowerCAmelCase      , (float, int)   ):
				raise ValueError("differentiate() requires a float as input for position"   )
		if not isinstance(__lowerCAmelCase      , __lowerCAmelCase   ):
				raise ValueError("differentiate() requires an int as input for order"   )
		_UpperCAmelCase		:       int								=      Dual(__lowerCAmelCase      , 1   )
		_UpperCAmelCase		:       Optional[int]								=      func(__lowerCAmelCase   )
		if order == 0:
				return result.real
		return result.duals[order - 1] * factorial(__lowerCAmelCase   )


if __name__ == "__main__":
						import doctest

						doctest.testmod()






						def  __lowerCAmelCase (__lowerCAmelCase   ):
								return y**2 * y**4





						print(differentiate(f, 9, 2))



