program prob6
    implicit none
    integer::i, j, l
    integer(8)::ans, sum, tmp, wa
    character(len=10)::S
    read(*,*) S
    l = len_trim(S)
    ans = 0
    wa = 0

    do i = 0, 2**(l-1)-1
        tmp = i
        sum = ichar(S(1:1)) - ichar('0')
        do j = 2, l
            if(mod(tmp,2) == 0) then
                sum = sum*10 + ichar(S(j:j)) - ichar('0')
            else
                wa = wa + sum
                sum = ichar(S(j:j)) - ichar('0')
            end if
            tmp = tmp/2
        end do
        wa = wa + sum
    end do
    write(*,*) wa
    stop
end program