시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 19 | 10 | 10 | 52.632% |
September 10th is forester day. On this occasion Magic forest dwellers decided to make a party. Kuzma beaver is assigned to take care about intellectual games. Kuzma has invented at his opinion quite interesting game.
Rules of the game are simple. Master announces positive integer N. Player needs to calculate product of digits for each positive integer up to N and report the greatest product.
All answers should be known beforehand to allow interactive communication during a game. This causes problems since N could be relatively big (1 ≤ N ≤ 2000000000). Kuzma is not good using computers; he asks you to write a program which having positive integer N will find correct answer.
Each line at input contains integer N.
Corresponding line at output should contain greatest product for this N.
1
1
101090000
43046721
28994
10368
4876
2268
2789
1008