program ManyFormulas

implicit none
integer :: I, J
integer(8) :: len, co, checker, K
character(10) :: S
integer(8), dimension(512) :: num, counter 

read(*,*) S
len = len_trim(S)

do I = 1, 512
num(I) = 0
end do

do I = 1, 2**(len-1)
 do J = 1, 512
 counter(J) = 0
 end do
 counter(len) = len
 do J = 1, len-1
  if (btest(I-1,J-1)) then
  counter(J) = J
  end if
 end do
!write(*,*) (counter(J),J=1,3)
checker = 1
 do J = 1, len
  if (counter(J)/=0) then
  read(S(checker:counter(J)),*) K
!  write(*,*) K
  num(I) = num(I) + K
  checker = counter(J) + 1
  end if
 end do
end do

write(*,*) sum(num)
 
end program