1’s For All

아직 제출이 없습니다시간 제한15초메모리 제한1024 MB

문제

The complexity of an integer is the minimum number of 11's needed to represent it using only addition, multiplication and parentheses. For example, the complexity of 22 is 22 (writing 22 as 1+11+1) and the complexity of 1212 is 77 (writing 1212 as (1+1+1)×(1+1+1+1)(1+1+1)\times (1+1+1+1)). We'll modify this definition slightly to allow the concatenation operation as well. This operation (which we'll represent using ©) takes two integers and "glues" them together, so 12 12\ © 34\ 34 becomes the four digit number 12341234. Using this operation, the complexity of 1212 is now 33 (writing it either as (1 (1 \ © 1)+1\ 1) + 1 or 1 1\ © (1+1)\ (1+1)).  Note that the concatenation operation ignores any initial zeroes in the second operand: 1 1\ © 01\ 01 does not result in 101101 but results in 1111.

We'll give you 11 guess what the object of this problem is.

입력

Each test case consists of a single line containing an integer nn, where 0<n100,0000 < n \leq 100\\, 000.

출력

Output the complexity of the number, using the revised definition above.