import qualified Data.ByteString.Char8 as C
import Data.Int
import Data.List
import Data.Maybe
import qualified Data.Vector.Unboxed as V

main = C.interact $ put . sol . get

get = V.tail . V.unfoldr (C.readInt . C.dropWhile (<'0'))

put = C.pack . show

sol v = if 0 `V.elem` v then 0 else fromMaybe (-1) $ V.foldM' f (1 :: Int64) v

f x a  = let y = x*fromIntegral a in if y>10^18 then Nothing else Just y