using System;

namespace test
{
    class Program
    {
        static long count(long digit)
        {
            long five = digit / 5;
            long two = (digit - five * 5) / 2;
            return five + two + (digit - five * 5 - two * 2);
        }
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long amount = 0;
            while (n > 0)
            {
                amount += count(n % 10);
                n /= 10;
            }
            Console.WriteLine(amount);
        }
    }
}