program name
    implicit none
    character(10):: s
    integer(8):: bmax,i,ni,j,ans,nans
    integer(8),allocatable:: bit(:)

    read*, s
    bmax = 2**(len_trim(s)-1)-1
    allocate(bit(len_trim(s)-1))
    ans=0
    do i=0,bmax
        ni=i
        do j=1,size(bit)
            bit(j) = and(ni,1)
            ni = rshift(ni,1)
        end do
        
        nans = ichar(s(1:1)) - ichar('0')

        do j=1,size(bit)
            if (bit(j) == 0)then
                nans=nans*10 + ichar(s(j+1:j+1)) - ichar('0')
            else
                ans=ans+nans
                nans=ichar(s(j+1:j+1)) - ichar('0')
            end if
        end do
        ans=ans+nans
    end do
    
    print*, ans
end program name