main :: IO () main = do n <- readLn :: IO Integer let l = if even n then let h = l `div` 2 in 2 * fib (h - 1) * fib h else fib l if l == 0 then do putStrLn "1" putStrLn "INF" else do print n print l fib :: Integer -> Integer fib i = case fastDoubling i of (a, _) -> a fastDoubling :: Integer -> (Integer, Integer) fastDoubling 0 = (0, 1) fastDoubling 1 = (1, 1) fastDoubling i = let (a, b) = fastDoubling (i `div` 2) in if even i then (a * (2 * b - a), a * a + b * b) else (a * a + b * b, b * (2 * a + b))