시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB19101052.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

예제 출력 1

1

예제 입력 2

101090000

예제 출력 2

43046721

예제 입력 3

28994

예제 출력 3

10368

예제 입력 4

4876

예제 출력 4

2268

예제 입력 5

2789

예제 출력 5

1008