NGM - A Game with Numbers

Nikifor and Trofim play the following game: they write some positive integer smaller than 2,000,000,000 and take turns one after another. Nikifor is the first to make a move. The turn is made by the following rule: from the written integer any non-zero digit is subtracted, and the new integer replaces the old one on the desk. For example for integer 40534, the next move can be: 40530, 40531 or 40529. The winner is the player who writes zero on the desk.

Write a program to decide who will win if both players do their best.

Input

The input contains the positive integer from which the game is started.

Output

In the first line you must write 1 if Nikifor wins and 2 otherwise. If Nikifor wins then in the second line you must output the move in the first turn which guarantees victory for him. If there are many such moves then output any of them.

Example

Input:
14

Output:
1
4

Author: Filimonenkov D.O.


Added by:Roman Sol
Date:2006-05-05
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:ZCon 2007

hide comments
2015-10-02 21:34:42
ac in one go ! extremely easy one! :)
2015-09-19 21:22:30
DON'T READ THE COMMENTS... SPOILERS!!!
2015-09-11 10:05:25
the digit should be from number???
Please Provide some more test cases.
2015-08-30 17:58:20 NIKHIL KUMAR SINGH
TRUE......@joydeeodas123 and @Manishi Goel ....the comments are seriously the spoilers ....altough I was lucky to read them later
2015-08-30 00:07:15
This is crazy !!! No need to to go through the ques even ,simply going through the comments question can be answered...let others think ...stop spoiling
2015-08-25 20:52:24 suhas
thought for few minutes... and then it hit me. simple one. :)
2015-08-22 21:12:15
solved in one go....excellent problem.....
2015-08-18 07:33:32
please can someone give me some more test cases
2015-08-11 09:10:52 devesh upadhyay
easy one ;-p
2015-08-03 13:10:57 Manishi Goel
spoilers everywhere :(
Let others think
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.