program abc129e
  implicit none
  character(100000) :: s
  integer :: n, i
  integer(8),dimension(:,:),allocatable :: dp
  read *, s
  n = len_trim(s)
  allocate(dp(2,0:n))
  dp = 0
  dp(1,0) = 1
  do i = 1,n
     dp(1,i) = mod(merge(dp(1,i-1),dp(1,i-1)*2,s(i:i)=='0'),10**9+7)
     dp(2,i) = mod(merge(dp(2,i-1)*3,dp(1,i-1)+dp(2,i-1)*3,s(i:i)=='0'),10**9+7)
  end do
  print *, mod(sum(dp(:,n)),10**9+7)
end program abc129e
