If two numbers are the same, if the front is not greater than the back, the result is the front number. If the front is bigger than the back, you divide it.
If the symbols are opposite, forget the symbols, the algorithm is the same as before, and then add up the symbols.