The Call of Rain
Ritual shamans Six-String Neck and He Who Creates Joy are preparing for the grand festival honoring the deity Btas Odappoed and the pilgrimage to the sacred city of Amostork.
The pilgrimage is to culminate in an intricate ritual to summon rain from fish, which unfolds as follows:
First, for two years prior to the ritual, special deer pink hedgehogs must be raised in Sudislavl. By the age of two, these hedgehogs develop particularly long and branched spines.
Next, each ritual shaman must connect with the spirit of each of the N hedgehogs selected by breeders by sleeping with the hedgehog in a hammock for a full lunar cycle.
The shamans then need to capture and tame the rare mountain bird Sveedopli. These birds are known for their unyielding iron will, rare kindness towards hedgehogs, and a deep-seated aversion to ritual shamans, a trait passed down through generations (due to the mandatory one-and-a-half-meter ceremonial attire required to catch Sveedopli).
The shamans must then trim each of the N hedgehogs so that for each number i (1 ≤ i ≤ N), there is exactly one hedgehog with precisely i spines.
The number of spines must be painted in green on the back of each hedgehog. The hedgehogs resist this due to their innate sense of harmony.
All hedgehogs are then placed in a large basket, which is attached to the legs of the tamed Sveedopli.
The Sveedopli is released, distributing the hedgehogs around the outskirts of the ancient cursed necropolis Oskam-Aava.
Finally, the ritual shamans must traverse the outskirts of the ancient cursed necropolis Oskam-Aava to find the hedgehogs, while also contending with the ghosts of previous ritual shamans who perished there.
It is known that the ritual's success increases with the product of the digits of the number written on the first hedgehog found. However, since no shaman who has started the ritual has ever returned, the shamans decided to bend the rules slightly and keep the hedgehog with the highest product of digits in the number written on it. The task is to determine which hedgehog to keep.
Input
The first line of the input contains a single integer N (1 ≤ N ≤ 10^9) - the number of hedgehogs selected by breeders.
Output
Output the product of the digits of the number written on the back of the hedgehog with the maximum product.