using System;
class zad1{
    static void Main()
    {
        int v,br,m,d,p;
        v=int.Parse(Console.ReadLine());
        br=0;
        while(v>0)
        {
            m=v%10;
            v=v/10;
            p=m%5;
            br=br+p;
            m=m-p*5;
            d=m%2;
            br=br+d
            m=m-d*2;
            br=br+m;
        }
        Console.WriteLine("{0}",br);
    }
}