ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

USU Championship 2002

About     Problems     Submit solution     Judge status     Standings
Contest is over

G. Chernobyl’ Eagles

Time limit: 1.0 second
Memory limit: 64 MB
Problem illustration
A Chernobyl’ eagle has several heads (for example, the eagle on the Russian National Emblem is a very typical one, having two heads; there exist Chernobyl’ eagles having twenty-six, one and even zero heads). As all eagles, Chernobyl’ eagles are very intelligent. Moreover, IQ of a Chernobyl’ eagle is exactly equal to the number of its heads. These eagles can also enormously enlarge their IQ, when they form a group for a brainstorm. IQ of a group of Chernobyl’ eagles equals to the product of IQ’s of eagles in the group. So for example, the IQ of a group, consisting of two 4-headed eagles and one 7-headed is 4*4*7=112. The question is, how large can be an IQ of a group of eagles with a given total amount of heads.

Input

There is one positive integer N in the input, N ≤ 3000 — the total number of heads of Chernobyl’ eagles in a group.

Output

Your program should output a single number — a maximal IQ, which could have a group of Chernobyl’ eagles, with the total amount of heads equal to N.

Sample

inputoutput
5
6
Problem Author: folklore, proposed by Leonid Volkov
Problem Source: The Seventh Ural State University collegiate programming contest
To submit the solution for this problem go to the Problem set: 1222. Chernobyl’ Eagles