e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Summer School 2011 in Sevastopol, Day 3

The desired quantity

For a givennon-negativep-arynumberto determine itsvaluemodulo(p-1).The answerto givethe p-arysystem, without leading zeros.

Input

The first linecontains the number ofp (2p10). In the second linewritethe specified numberof p-aryform, consistingof no more than1000bits, withno leadingzeros.

Output

The output filea unique numberin the p-aryform -answerthe problem.

Time limit 1 second
Memory limit 64 MiB
Input example #1
10
123456781987654321
Output example #1
1