module Main where main = do a <- getIntList m = [1, 0, -1, 0] ++ [0, 0 ..] where loop a' | length a' <= 4 = calc a' | otherwise = loop $ calc a' fmt ns | s2 == [] = ["0", "0"] where ns' = dropWhile (==0) ns s1 = show . pred $ length ns' calc :: [Int] -> [Int] calc ns = tail $ zipWith (-) ns $ map (* (head ns)) m getIntList :: IO [Int] getIntList = map read . words <$> getLine