#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int v, vc;
    int counter = 0;
    int c;

    scanf("%d",&v);
    if(v <1 || v > pow(10,18))
    {
        return 0;
    }
    vc = v;
    int digit = 0;

    while(vc != 0)
    {
        counter++;
        vc /= 10;
    }
    c = counter;
    vc = v;
    int num[counter];
    for(int i=0; i<counter; i++)
    {
        num[i] = vc%10;
        vc = vc/10;
    }
    if(v > 0)
    {
        for(int i = 0; i<counter; i++)
        {
            if(num[i] == 1)
            {
                if(c == 6)
                {
                    digit++;
                }
                else if(c == 5)
                {
                    digit += 20;
                }
                else if(c == 4)
                {
                    digit += 2;
                }
                else
                {
                    digit++;
                }
            }
            else if(num[i] == 2)
            {
                if(c == 6)
                {
                    digit++;
                }
                else if(c == 5)
                {
                    digit += 40;
                }
                else if(c == 4)
                {
                    digit += 4;
                }
                else
                {
                    digit++;
                }

            }
            else if(num[i] == 3)
            {
                if(c == 6)
                {
                    digit += 2;
                }
                else if(c == 5)
                {
                    digit += 60;
                }
                else if(c == 4)
                {
                    digit += 6;
                }
                else
                {
                    digit += 2;
                }
            }
            else if(num[i] == 4)
            {
                if(c == 6)
                {
                    digit += 2;
                }
                else if(c == 5)
                {
                    digit += 80;
                }
                else if(c == 4)
                {
                    digit += 8;
                }
                else
                {
                    digit += 2;
                }
            }
            else if(num[i] == 5)
            {
                if(c == 6)
                {
                    digit++;
                }
                else if(c == 5)
                {
                    digit += 100;
                }
                else if(c == 4)
                {
                    digit += 10;
                }
                else
                {
                    digit++;
                }

            }
            else if(num[i] == 6)
            {
                if(c == 6)
                {
                    digit += 2;
                }
                else if(c == 5)
                {
                    digit += 120;
                }
                else if(c == 4)
                {
                    digit += 12;
                }
                else
                {
                    digit += 2;
                }
            }
            else if(num[i] == 7)
            {
                if(c == 6)
                {
                    digit += 2;
                }
                else if(c == 5)
                {
                    digit += 140;
                }
                else if(c == 4)
                {
                    digit += 14;
                }
                else
                {
                    digit += 2;
                }
            }
            else if(num[i] == 8)
            {
                if(c == 6)
                {
                    digit += 3;
                }
                else if(c == 5)
                {
                    digit += 160;
                }
                else if(c == 4)
                {
                    digit += 16;
                }
                else
                {
                    digit += 3;
                }
            }
            else if(num[i] == 9)
            {
                if(c == 6)
                {
                    digit += 3;
                }
                else if(c == 5)
                {
                    digit += 180;
                }
                else if(c == 4)
                {
                    digit += 18;
                }
                else
                {
                    digit += 3;
                }
            }
            c--;
        }
    }

    printf("1");
    return 0;
}