Given a non-negative number in base , determine its value modulo p - 1. Output the result in base without leading zeros.
The first line contains the integer (2 \leq p \leq 10). The second line contains the representation of the number in base , consisting of at most digits and having no leading zeros.
Output a single number in base — the answer to the problem, without leading zeros.
Example 1