407171: GYM102697 142 Hydra Tree

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

142. Hydra Treetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 35 points.

You have a tree that is growing very fast. At first, the tree has one branch. On each successive day, the tree grows a certain number of branches. On each day, the number of new branches is calculated as $$$n$$$ times $$$b$$$, where $$$b$$$ represents how many branches were on the tree on the previous day, and $$$n$$$ is a variable you have to calculate. $$$n$$$ will always be greater than one.

At an unknown number of days, the tree has $$$x$$$ branches. Given this value, figure out the minimum possible value of $$$n$$$ used in the formula, given that the tree started out with exactly one branch.

Input

The only line of input contains a single positive integer $$$x$$$. $$$x$$$ will be less than 10000.

Output

Output a single positive integer $$$n$$$: the minimum possible value of $$$n$$$, greater than one, such that the tree could have $$$x$$$ branches at some point. $$$n$$$ has to stay the same throughout the entire process of growing the tree, i.e. it cannot change between days.

ExamplesInput
36
Output
5
Input
66
Output
65

加入题单

算法标签: