program atcoder
implicit none
character(len=10) :: s
character :: c
integer(16) :: i, bin, j, ans, val, sum
integer(16), allocatable :: plus(:)

read(*,*) s

allocate(plus(len_trim(s)-1))

ans = 0
do i = 0, 2**(len_trim(s)-1)-1
  c = s(1:1)
  read(c,*) sum
  plus = 0
  bin = i
  do j = 1, len_trim(s)-1
    plus(j) = mod(bin,2)
    bin = bin/2
  end do
  do j = 2, len_trim(s)
    c = s(j:j)
    read(c,*) val
    if (plus(j-1) == 0) then
      sum = sum*10 + val
    else
      ans = ans + sum
      sum = val
    end if
  end do
  ans = ans + sum
end do

write(*,'(i0)') ans

end program atcoder