In a very ancient country the following game was popular. Two people play the game. Initially first player writes a string *s*_{1}, consisting of exactly nine digits and representing a number that does not exceed *a*. After that second player looks at *s*_{1} and writes a string *s*_{2}, consisting of exactly nine digits and representing a number that does not exceed *b*. Here *a* and *b* are some given constants, *s*_{1} and *s*_{2} are chosen by the players. The strings are allowed to contain leading zeroes.

If a number obtained by the concatenation (joining together) of strings *s*_{1} and *s*_{2} is divisible by *mod*, then the second player wins. Otherwise the first player wins. You are given numbers *a*, *b*, *mod*. Your task is to determine who wins if both players play in the optimal manner. If the first player wins, you are also required to find the lexicographically minimum winning move.

提交代码