September 10th is Forest Day. To celebrate, the dwellers of the Magic Forest decided to throw a party, and Kuzma the beaver was put in charge of the intellectual games. The rules of the game Kuzma invented are simple.
The host announces a positive integer N. For every positive integer from 1 to N, the player computes the product of that integer's digits, and must report the greatest such product.
To run the game smoothly, all answers must be known in advance. This is tricky because N can be fairly large (1≤N≤2000000000). Since Kuzma is not comfortable with computers, write a program that, given a positive integer N, finds the correct answer.
In other words, over all integers k with 1≤k≤N, output the maximum possible product of the digits of k.
Each line of the input contains one integer N. The input may span several lines until end of file (EOF). (1≤N≤2000000000)
For each N, print on the corresponding line the greatest digit product among the integers from 1 to N.