P1689 Equation Solving

Description

Given an equation of the form $X+Y=Z$ or $X-Y=Z$. Among $X$, $Y$, and $Z$, two values are given, and the remaining one is represented by `?`. Compute the value of `?`. There may be extra spaces in the equation.

Input Format

The input consists of a single line containing a string representing the equation.

Output Format

Output one integer on a single line, which is the value represented by `?`.

Explanation/Hint

Constraints: For $100\%$ of the testdata, it is guaranteed that $0 \le X, Y, Z \lt 10^9$, the input string always conforms to the specified format, and its length does not exceed $10^6$. Translated by ChatGPT 5