import qualified Data.ByteString.Char8 as BS

add :: Int -> Int -> Int
add i1 i2 = mod (i1 + i2) 1000000007

add3 :: Int -> Int -> Int -> Int
add3 i1 i2 i3 = add i1 $ add i2 i3 

mul3 :: Int -> Int
mul3 i = add3 i i i 

mul2 :: Int -> Int
mul2 i = add i i 

foldfunc :: Char -> (Int,Int) -> (Int,Int)
foldfunc c (tn,r)
  | c == '0' = (tn3,r)
  | c == '1' = (tn3, add3 1 tn (mul2 r) )
  | otherwise = (tn,r)
  where
    tn3 = mul3 tn

solve :: BS.ByteString -> Int
solve s = 1 + (snd $ BS.foldr' foldfunc (1,0) s)

main = do
    bs <- BS.getLine
    print $ solve bs
