main = getContents >>= print . solve 1 . map read . tail . words

solve ans [] = if 10^18 < ans then -1 else ans
solve ans (a:as)
  | 0 `elem` (a:as) = 0
  | 10^18 < ans = -1
  | otherwise = solve (ans * a) as