D. Digit One Dilemma
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

In the middle of the ocean lies a small island called Unoland. The people of this country have a crazy idea in their heads: they believe that the number $$$1$$$ is the best number in the world.

Naturally, this obsession reached the country's currency as well. One day, the head of the central bank got tired of regular banknotes and issued an order. From that moment on, the bank was only allowed to produce banknotes composed exclusively of the digit $$$1$$$. As a result, on the island you will only find banknotes of $$$1$$$ unopeso, $$$11$$$ unopesos, $$$111$$$ unopesos, $$$1111$$$ unopesos, and so on. There is no maximum unopeso banknote; a banknote always exists for any desired number of ones.

The island's population loved this system, as it guarantees that any positive integer can be formed by summing unopeso banknotes, making transactions much easier because you can always pay the exact amount without needing any change. Since carrying a large number of banknotes is annoying, people always seek to minimize the total number of banknotes used when paying. Unoland has hired you to design a program capable of calculating the minimum number of banknotes required to sum up to $$$X$$$ unopesos.

Input

A single line containing an integer $$$X$$$ ($$$1 \le X \le 10^{100000}$$$), the total amount of unopesos to be summed.

Output

A single integer, the minimum number of banknotes required to form the value $$$X$$$.

Examples
Input
14
Output
4
Input
1997
Output
27
Input
123456789
Output
9
Input
111222333444555666777888999
Output
9
Note

In the first example, we can pay $$$14$$$ unopesos with $$$1$$$ banknote of $$$11$$$ unopesos and $$$3$$$ banknotes of $$$1$$$ unopeso.

In the second example, we can pay $$$1997$$$ unopesos with $$$1$$$ banknote of $$$1111$$$ unopesos, $$$6$$$ banknotes of $$$111$$$ unopesos, and $$$20$$$ banknotes of $$$11$$$ unopesos. This gives a total of $$$1111+6\times 111+20\times 11=1111+666+220=1997$$$, using $$$1+6+20=27$$$ banknotes. It can be shown that we cannot pay this amount using fewer banknotes.