The desired quantity#2424

The desired quantity

1 second
64 megabytes
Very easy

Given a non-negative number in base , determine its value modulo p - 1. Output the result in base without leading zeros.

Input

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

Output a single number in base — the answer to the problem, without leading zeros.

Examples

Example 1

Loading
Loading