integer(16),dimension(10,10)::a
character(11)S
integer(16) answer
read*,S
a=0
do i=1,len_trim(S)
	do j=i,len_trim(S)
    	if(j==i)then
        	a(i,j)=2**(i-1)
        else
        	a(i,j)=2**(j-2)
        endif
    end do
end do
answer=0
do i=1,len_trim(s)
	read(S(i:i),*) aki
    do j=i,len_trim(S)
    	answer=answer+aki*10**(len_trim(s)-j)*a(i,j)
    end do
end do
print"(I0)",answer
end