program prob6
    implicit none
    character(11) :: s
    integer(8) :: L
    integer(8) :: n, tmp, pre, a
    integer(8) :: ans
    integer(8) :: i, j

    read(*,*) s
    L = len_trim(s)

    n = 2 ** (L-1)

    ans = 0
    do i = 0, n-1
        tmp = 0
        pre = 0
        do j = 0, L-2
            if(btest(i, j)) then
                read(s(pre+1:j+1),*) a
                tmp = tmp + a
                pre = j+1
            end if
        end do
        read(s(pre+1:L),*) a
        tmp = tmp + a
        ans = ans + tmp
    end do

    write(*,*) ans

    stop
contains
end program prob6