There are standard dice on a table. Each die has faces numbered from to , and the numbers on opposite faces sum to .
Initially, the sum of the numbers on the top faces is .
You leave exactly one die untouched and turn every other die upside down, exchanging its top and bottom faces. The sum of the numbers on the top faces becomes .
Find the number on the top face of the untouched die.
The input consists of three integers , , and : the number of dice, the initial sum of their top faces, and the sum after turning all but one die upside down.
Print the number on the top face of the untouched die.
The top faces can initially be . Turning the first two dice upside down changes them to . The sums are and , and the untouched die shows .
There is only one die, so it remains untouched. Its top face shows both before and after the operation.
The top faces can initially be . Turning the first three dice upside down changes them to . The sums are and , and the untouched die shows .