Codeforces Round 485 (Div. 1)
D
Perfect Encoding
Codeforces
3100
原题
← CE →
翻译中…

You are working as an analyst in a company working on a new system for big data storage. This system will store $n$ different objects. Each object should have a unique ID.

翻译中…

To create the system, you choose the parameters of the system — integers $m \ge 1$ and $b_{1}, b_{2}, \ldots, b_{m}$. With these parameters an ID of some object in the system is an array of integers $[a_{1}, a_{2}, \ldots, a_{m}]$ where $1 \le a_{i} \le b_{i}$ holds for every $1 \le i \le m$.

翻译中…

Developers say that production costs are proportional to $\sum_{i=1}^{m} b_{i}$. You are asked to choose parameters $m$ and $b_{i}$ so that the system will be able to assign unique IDs to $n$ different objects and production costs are minimized. Note that you don't have to use all available IDs.

翻译中…

Input

翻译中…

In the only line of input there is one positive integer $n$. The length of the decimal representation of $n$ is no greater than $1.5 \cdot 10^{6}$. The integer does not contain leading zeros.

翻译中…

Output

翻译中…

Print one number — minimal value of $\sum_{i=1}^{m} b_{i}$.

翻译中…

样例

Input #1
36
Output #1
10
InputCopy OutputCopy
Input #2
37
Output #2
11
InputCopy OutputCopy
Input #3
12345678901234567890123456789
Output #3
177
InputCopy OutputCopy
题目信息
题号
986D
时间限制
2 s
内存限制
256 MB
标签
FFT
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。