program kadai
implicit none
integer  ::  size,ans
integer  ::  n
character(100001)  :: num

read(*,*) n

if (n<10) then
    write(*,*) n
    stop
end if

if (n<100) then
    write(*,*) 9
    stop
end if

if (n<1000) then
    write(*,*) 9+n-99
    stop
end if

if (n<10000) then
    write(*,*) 909
    stop
end if

if (n<100000) then
    write(*,*) 9+900+n-9999
    stop
end if

if (n==100000) then
    write(*,*) 90909
    stop
end if


stop

end program kadai