-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU main = interact $ show . foldl1 (*) . map sum . zipWith ($) [take 2, concat . map (foldl1 (((return . ((0:0:repeat 1) !!) . length) .) . filter . ((==) . head)) . replicate 2) . takeWhile (not . null) . flip (scanl (const . tail)) [0 ..] . drop 3] . replicate 2 . map read . lines