The task is of the following type: write the simplest calculator that can perform addition and subtraction and control overflow. The problem arose in the following moment - when subtracting two different numbers (different signs, including the same), the calculation and output is correct, and when the operands with different signs are summed, incorrect counting occurs.