"""simple docstring"""




__lowerCAmelCase    :							Tuple													=						"Alexander Joslin"

import operator as op

from .stack import Stack







def 							_UpperCAmelCase		(       lowerCamelCase__     ):





		"""simple docstring"""




		lowerCAmelCase__        =   {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub}

		lowerCAmelCase__        =   Stack()
		lowerCAmelCase__        =   Stack()

		for i in equation:
				if i.isdigit():
						# RULE 1
						operand_stack.push(int(lowerCamelCase__     )     )
				elif i in operators:
						# RULE 2
						operator_stack.push(lowerCamelCase__     )
				elif i == ")":
						# RULE 4
						lowerCAmelCase__        =   operator_stack.peek()
						operator_stack.pop()
						lowerCAmelCase__        =   operand_stack.peek()
						operand_stack.pop()
						lowerCAmelCase__        =   operand_stack.peek()
						operand_stack.pop()

						lowerCAmelCase__        =   operators[opr](lowerCamelCase__			,  lowerCamelCase__     )
						operand_stack.push(lowerCamelCase__     )

    # RULE 5
		return operand_stack.peek()


if __name__ == "__main__":
			__lowerCAmelCase    :							Optional[Any]													=						"(5 + ((4 * 2) * (2 + 3)))"
			# answer = 45
			print(F"{equation} = {dijkstras_two_stack_algorithm(equation)}")



"""simple docstring"""




def 							_UpperCAmelCase		(       lowerCamelCase__ = 50     ):





		"""simple docstring"""




		lowerCAmelCase__        =   [[0] * 3 for _ in range(length + 1     )]

		for row_length in range(length + 1     ):
				for tile_length in range(2			,  5     ):
						for tile_start in range(row_length - tile_length + 1     ):
								different_colour_ways_number[row_length][tile_length - 2] += (
								    different_colour_ways_number[row_length - tile_start - tile_length][
								        tile_length - 2
								    ]
								    + 1
								)

		return sum(different_colour_ways_number[length]     )


if __name__ == "__main__":
			print(F"{solution() = }")




